sp
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parent 9f6246a · Browse files · 1 file·+8 added−6 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+8 added−6 removed
- other:+8 added−6 removed
Provenance
- Commit
3d49eb4- Tree
a96ebfa- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
9f6246a
1 file changed+8 added−6 removed
modified:docs/user/quickstart.rst+8 added-6 removed
37 unmodified lines38 39 >>> r.content40 '[{"repository":{"open_issues":0,"url":"https://github.com/...41 42-Requests does its best to decode content from the server. Most unicode charsets, ``gzip``, and ``deflate`` encodings are all seamlessly decoded.42+Requests does its best to decode content from the server. Most unicode43+charsets, ``gzip``, and ``deflate`` encodings are all seamlessly decoded.44 45 46 Make a POST Request47 -------------------3 unmodified lines51 r = requests.post("http://httpbin.org/post")52 53 54 Typically, you want to send some form-encoded data — much like an HTML form.54-To do this, simply pass a dictionary to the `data` argument. Your dictionary of data will automatically be form-encoded when the request is made::55+To do this, simply pass a dictionary to the `data` argument. Your56+dictionary of data will automatically be form-encoded when the request is made::57 58 >>> payload = {'key1': 'value1', 'key2': 'value2'}59 >>> r = requests.post("http://httpbin.org/post", data=payload)60 >>> print r.content54 unmodified lines115 >>> r.content116 {117 "origin": "179.13.100.4",118 "files": {117- "hmm": "<censored...binary...data>"119+ "report.xls": "<censored...binary...data>"120 },121 "form": {},122 "url": "http://httpbin.org/post",123 "args": {},131 unmodified lines255 Requests will automatically perform location redirection while using impodotent methods.256 257 GitHub redirects all HTTP requests to HTTPS. Let's see what happens::258 257- >>> r = request.get('http://github.com')259+ >>> r = requests.get('http://github.com')260 >>> r.url261 'https://github.com/'262 >>> r.status_code263 2005 unmodified lines269 270 If you're using GET, HEAD, or OPTIONS, you can disable redirection271 handling with the ``disable_redirects`` parameter::272 271- >>> r = request.get('http://github.com')273+ >>> r = requests.get('http://github.com')274 >>> r.status_code275 301276 >>> r.history277 []278 279 If you're using POST, PUT, PATCH, *&c*, you can also explicitly enable redirection as well::280 279- >>> r = request.post('http://github.com')281+ >>> r = requests.post('http://github.com')282 >>> r.url283 'https://github.com/'284 >>> r.history285 [<Response [301]>]38 unmodified lines