Merge pull request #1886 from meteozond/patch-1

Added info about posted files headers
This commit is contained in:
Cory Benfield
2014-01-28 01:07:23 -08:00
+2 -2
View File
@@ -234,10 +234,10 @@ Requests makes it simple to upload Multipart-encoded files::
...
}
You can set the filename explicitly::
You can set the filename, content_type and headers explicitly:
>>> url = 'http://httpbin.org/post'
>>> files = {'file': ('report.xls', open('report.xls', 'rb'))}
>>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}
>>> r = requests.post(url, files=files)
>>> r.text