У меня EVE и работает, и моя схема определена в соответствии с docs :
accounts = {
'name': {'type': 'string'},
'multimedia': {'type': 'media'}
}
Я могу отправить запрос multipart / form-data с одним файлом, но я хочуотправить список файлов мультимедиа.Я уже следовал документации и добавил следующие настройки:
# This flag allows passthrough from the driver of additional meta fields.
# For example, using the MongoDB driver, fields like content_type, name and
# length can be added to this list and will be passed-through from the
# underlying driver.When EXTENDED_MEDIA_INFO is used the field will be a
# dictionary whereas the file itself is stored under the file key and other
# keys are the meta fields.
EXTENDED_MEDIA_INFO = ['content_type', 'name', 'length']
# For multipart/form-data uploads to treat the incoming fields as JSON encoded strings
# and still be able to validate your fields.
MULTIPART_FORM_FIELDS_AS_JSON = True
# When using lists of media, there is no way to submit these in the default configuration.
# Enable AUTO_COLLAPSE_MULTI_KEYS and AUTO_CREATE_LISTS to make this possible. This allows
# to send multiple values for one key in multipart/form-data requests and in this way upload
# a list of files.
AUTO_COLLAPSE_MULTI_KEYS = True
AUTO_CREATE_LISTS = True
Теперь я пытаюсь отправить более одного файла и получаю следующую ошибку:
{
"status": "ERR",
"error": {
"code": 400,
"message": "An exception occurred: maximum recursion depth exceeded while calling a Python
object"
}
}
Есть предложения?Я использую этот фрагмент для проверки:
curl -X PATCH -H "Authorization: Bearer g6SZBmknNLf401915dNSJi4WNK72pk"
-H "Content-Type: multipart/form-data"
-F "multimedia=@text.json" -F "mutlimedia=@event.json"
http://localhost:5000/endpoint/_id
{"status": "ERR", "error": {"code": 400, "message": "An exception occurred:
maximum recursion depth exceeded while calling a Python object"}}
Журналы Eve:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/eve/methods/patch.py", line
244, in patch_internal issues = validator.errors
File "/usr/local/lib/python3.7/site-packages/cerberus/validator.py", line
464, in errors return self.error_handler(self._errors)
File "/usr/local/lib/python3.7/site-packages/cerberus/errors.py", line
493, in __call__self.extend(errors)
File "/usr/local/lib/python3.7/site-packages/cerberus/errors.py", line
397, in extend self.add(error)
File "/usr/local/lib/python3.7/site-packages/cerberus/errors.py", line
510, in add error = deepcopy(error)
File "/usr/local/lib/python3.7/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.7/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/usr/local/lib/python3.7/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/usr/local/lib/python3.7/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/local/lib/python3.7/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.7/copy.py", line 281, in _reconstruct
if hasattr(y, '__setstate__'):
File "/usr/local/lib/python3.7/site-packages/werkzeug/datastructures.py",
line 2821, in __getattr__return getattr(self.stream, name)
File "/usr/local/lib/python3.7/site-packages/werkzeug/datastructures.py",
line 2821, in __getattr__return getattr(self.stream, name)
File "/usr/local/lib/python3.7/site-packages/werkzeug/datastructures.py",
line 2821, in __getattr__return getattr(self.stream, name)
[Previous line repeated 485 more times]
RecursionError: maximum recursion depth exceeded while calling a Python
object
Проблема была отправлена в проект Eve Github repo .