Skip to content
Myr

updated docs for last change in `files` argument to support explicit filename.

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

authored by Rolando Espinoza La fuente · committed by Rolando Espinoza La fuente · parent c165255 · Browse files · 2 files+26 added−1 removed
This commit

State

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

Diff stats

2 files+26 added−1 removed

  • other:+26 added−1 removed

2 files+26 added−1 removed

modified:docs/user/quickstart.rst+25 added
130 unmodified lines
131 },132 "data": ""133 }134135Setting filename explicitly::136137 >>> url = 'http://httpbin.org/post'138 >>> files = {'file': ('report.xls', open('report.xls', 'rb'))}139140 >>> r = requests.post(url, files=files)141 >>> r.content142 {143 "origin": "179.13.100.4",144 "files": {145 "file": "<censored...binary...data>"146 },147 "form": {},148 "url": "http://httpbin.org/post",149 "args": {},150 "headers": {151 "Content-Length": "3196",152 "Accept-Encoding": "identity, deflate, compress, gzip",153 "Accept": "*/*",154 "User-Agent": "python-requests/0.8.0",155 "Host": "httpbin.org:80",156 "Content-Type": "multipart/form-data; boundary=127.0.0.1.502.21746.1321131593.786.1"157 },158 "data": ""159 }160161162Response Status Codes163---------------------164165We can check the response status code::
186 unmodified lines
modified:requests/api.py+1 added-1 removed
35 unmodified lines
36 :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.37 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.38 :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.39 :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.40 :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.40 :param files: (optional) Dictionary of 'name': file-like-objects (or {'name': ('filename', fileobj)}) for multipart encoding upload.41 :param auth: (optional) Auth typle to enable Basic/Digest/Custom HTTP Auth.42 :param timeout: (optional) Float describing the timeout of the request.43 :param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.44 :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
99 unmodified lines