example looked wrong

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'.
This commit is contained in:
anentropic
2012-08-02 13:56:12 +02:00
parent b47418533a
commit fdec88de99
+2 -2
View File
@@ -189,14 +189,14 @@ POST a Multipart-Encoded File
Requests makes it simple to upload Multipart-encoded files::
>>> url = 'http://httpbin.org/post'
>>> files = {'report.xls': open('report.xls', 'rb')}
>>> files = {'file': open('report.xls', 'rb')}
>>> r = requests.post(url, files=files)
>>> r.text
{
// ...snip... //
"files": {
"report.xls": "<censored...binary...data>"
"file": "<censored...binary...data>"
},
// ...snip... //
}