Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursion problem #54

Open
R1Sen007 opened this issue Sep 26, 2024 · 0 comments
Open

Recursion problem #54

R1Sen007 opened this issue Sep 26, 2024 · 0 comments

Comments

@R1Sen007
Copy link

R1Sen007 commented Sep 26, 2024

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.

STORAGE:

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()

ENDPOINT:

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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant