Skip to content
Myr

example looked wrong

Before adoption: this commit came in with the history the project adopted, so no landing records it.

From what I can tell from the source code (down thru urllib3) the key in the `files` dict is always the 'fieldname', while specifying a custom filename is optional. So in this example it is confusing to have a fieldname of 'report.xls' (the filename) where all the other examples use a fieldname of 'file'.

authored by anentropic · committed by anentropic · parent b474185 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:docs/user/quickstart.rst+2 added-2 removed
187 unmodified lines
188189Requests makes it simple to upload Multipart-encoded files::190191 >>> url = 'http://httpbin.org/post'192 >>> files = {'report.xls': open('report.xls', 'rb')}192 >>> files = {'file': open('report.xls', 'rb')}193194 >>> r = requests.post(url, files=files)195 >>> r.text196 {197 // ...snip... //198 "files": {199 "report.xls": "<censored...binary...data>"199 "file": "<censored...binary...data>"200 },201 // ...snip... //202 }203
249 unmodified lines