當前位置: 首頁>>代碼示例>>Python>>正文


Python settings.DATA_UPLOAD_MAX_MEMORY_SIZE屬性代碼示例

本文整理匯總了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 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:18,代碼來源:request.py

示例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 
開發者ID:Yeah-Kun,項目名稱:python,代碼行數:18,代碼來源:request.py

示例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 
開發者ID:MobSF,項目名稱:Mobile-Security-Framework-MobSF,代碼行數:54,代碼來源:apkid.py


注:本文中的django.conf.settings.DATA_UPLOAD_MAX_MEMORY_SIZE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。