Python django.conf.settings.DATA_UPLOAD_MAX_MEMORY_SIZE Examples
The following are 5
code examples of django.conf.settings.DATA_UPLOAD_MAX_MEMORY_SIZE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.conf.settings
, or try the search function
.
Example #1
Source File: request.py From bioforum with MIT License | 7 votes |
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
Example #2
Source File: request.py From Hands-On-Application-Development-with-PyCharm with MIT License | 6 votes |
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
Example #3
Source File: request.py From python with Apache License 2.0 | 6 votes |
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
Example #4
Source File: request.py From python2017 with MIT License | 6 votes |
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
Example #5
Source File: apkid.py From Mobile-Security-Framework-MobSF with GNU General Public License v3.0 | 4 votes |
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