Hi! I am newbee at FastApi and s3, but when i send file (from fastapi Swagger) to my endpoint, i have next traceback:
...
File "/usr/local/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/email/message.py", line 459, in <listcomp>
return [(k, self.policy.header_fetch_parse(k, v))
File "/usr/local/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/email/_policybase.py", line 316, in header_fetch_parse
return self._sanitize_header(name, value)
File "/usr/local/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/email/_policybase.py", line 287, in _sanitize_header
if _has_surrogates(value):
File "/usr/local/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/email/utils.py", line 57, in _has_surrogates
s.encode()
RecursionError: maximum recursion depth exceeded while calling a Python object
I can't find any problem because recursion overflow my terminal and i see only this repeating traceback.
from fastapi_storages import S3Storage
from fastapi_storages.integrations.sqlalchemy import FileType
class PrivateAssetS3Storage(S3Storage):
AWS_ACCESS_KEY_ID = "some info here"
AWS_SECRET_ACCESS_KEY = "some info here"
AWS_S3_BUCKET_NAME = "some-info-here"
AWS_S3_ENDPOINT_URL = "some.info.here"
AWS_DEFAULT_ACL = "public-read"
AWS_QUERYSTRING_AUTH = True
AWS_S3_USE_SSL = False
storage = PrivateAssetS3Storage()
from app.services.s3storage import storage
...
@router.post(
'/tests3_upload'
)
def create_upload_file(file: UploadFile):
key = storage.write(file=file.file, name='testFile')
url = storage.get_path(name=key)
print(url)
return {'url': url}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too