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

should be closed when post a file #5061

chibuchifan opened this issue Apr 18, 2019 · 0 comments


None yet
1 participant
Copy link

commented Apr 18, 2019

the post-a-multipart-encoded-file demo show:

>>> url = ''
>>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/', {'Expires': '0'})}

>>> r =, files=files)
>>> r.text
  "files": {
    "file": "<>"

here open a file report.xls, and in requests.module.RequestEncodingMixin it read the opened file:

            if isinstance(fp, (str, bytes, bytearray)):
                fdata = fp
            elif hasattr(fp, 'read'):
               # todo **here**
                fdata =
            elif fp is None:
                fdata = fp

so i'm not sure if it should be close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.