本文整理匯總了Python中django.conf.settings.DATA_UPLOAD_MAX_MEMORY_SIZE屬性的典型用法代碼示例。如果您正苦於以下問題:Python settings.DATA_UPLOAD_MAX_MEMORY_SIZE屬性的具體用法?Python settings.DATA_UPLOAD_MAX_MEMORY_SIZE怎麽用?Python settings.DATA_UPLOAD_MAX_MEMORY_SIZE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類django.conf.settings
的用法示例。
在下文中一共展示了settings.DATA_UPLOAD_MAX_MEMORY_SIZE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: body
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import DATA_UPLOAD_MAX_MEMORY_SIZE [as 別名]
def body(self):
if not hasattr(self, '_body'):
if self._read_started:
raise RawPostDataException("You cannot access body after reading from request's data stream")
# Limit the maximum request data size that will be handled in-memory.
if (settings.DATA_UPLOAD_MAX_MEMORY_SIZE is not None and
int(self.META.get('CONTENT_LENGTH') or 0) > settings.DATA_UPLOAD_MAX_MEMORY_SIZE):
raise RequestDataTooBig('Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.')
try:
self._body = self.read()
except IOError as e:
raise UnreadablePostError(*e.args) from e
self._stream = BytesIO(self._body)
return self._body
示例2: body
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import DATA_UPLOAD_MAX_MEMORY_SIZE [as 別名]
def body(self):
if not hasattr(self, '_body'):
if self._read_started:
raise RawPostDataException("You cannot access body after reading from request's data stream")
# Limit the maximum request data size that will be handled in-memory.
if (settings.DATA_UPLOAD_MAX_MEMORY_SIZE is not None and
int(self.META.get('CONTENT_LENGTH') or 0) > settings.DATA_UPLOAD_MAX_MEMORY_SIZE):
raise RequestDataTooBig('Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.')
try:
self._body = self.read()
except IOError as e:
six.reraise(UnreadablePostError, UnreadablePostError(*e.args), sys.exc_info()[2])
self._stream = BytesIO(self._body)
return self._body
示例3: apkid_analysis
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import DATA_UPLOAD_MAX_MEMORY_SIZE [as 別名]
def apkid_analysis(app_dir, apk_file, apk_name):
"""APKID Analysis of DEX files."""
if not settings.APKID_ENABLED:
return {}
try:
import apkid
except ImportError:
logger.error('APKiD - Could not import APKiD')
return {}
if not os.path.exists(apk_file):
logger.error('APKiD - APK not found')
return {}
apkid_ver = apkid.__version__
from apkid.apkid import Scanner, Options
from apkid.output import OutputFormatter
from apkid.rules import RulesManager
logger.info('Running APKiD %s', apkid_ver)
options = Options(
timeout=30,
verbose=False,
entry_max_scan_size=settings.DATA_UPLOAD_MAX_MEMORY_SIZE,
recursive=True,
)
output = OutputFormatter(
json_output=True,
output_dir=None,
rules_manager=RulesManager(),
include_types=False,
)
rules = options.rules_manager.load()
scanner = Scanner(rules, options)
res = scanner.scan_file(apk_file)
try:
findings = output._build_json_output(res)['files']
except AttributeError:
# apkid >= 2.0.3
try:
findings = output.build_json_output(res)['files']
except AttributeError:
logger.error('yara-python dependency required by '
'APKiD is not installed properly. '
'Skipping APKiD analysis!')
findings = {}
sanitized = {}
for item in findings:
filename = item['filename']
if '!' in filename:
filename = filename.split('!', 1)[1]
sanitized[filename] = item['matches']
return sanitized