Skip to content
Myr

Reverted GET example back to Github.

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

authored by Joseph McCullough · committed by Joseph McCullough · parent 827b234 · Browse files · 1 file+4 added−7 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+4 added−7 removed

  • other:+4 added−7 removed

1 file+4 added−7 removed

modified:docs/user/quickstart.rst+4 added-7 removed
21 unmodified lines
22------------------2324Making a standard request with Requests is very simple.2526Let's use httpbin to test our requests. ::26Let's get GitHub's public timeline ::2728 r = requests.get("http://httpbin.org/get")28 r = requests.get('https://github.com/timeline.json')2930Now, we have a :class:`Response` object called ``r``. We can get all the31information we need from this.32333434Response Content35----------------3637We can read the content of the server's response::3839 >>> r.content41 '{\n "url": "http://httpbin.org/get", \n "headers": ...40 '[{"repository":{"open_issues":0,"url":"https://github.com/...414243Make a POST Request44------------------
8 unmodified lines
5354 >>> dataDict = {"key1":"value1", "key2":"value2"}55 >>> r = requests.post("http://httpbin.org/post", data=dataDict)56 >>> r.content58 '{\n "origin": "::ffff:YourIpAddress", \n "files": {}, \n "form": {\n "key2": "value2", \n "key1": "value1"\n }, 57 '{\n "origin": "::ffff:YourIpAddress", \n "files": {}, \n "form": {\n "key2": "value2", \n "key1": "value1"\n }, ...5859Note the data= argument is equivalent to -d in cURL scripts. dataDict will60be form-encoded. 616362Response Status Codes63---------------------6465We can check the response status code::
117 unmodified lines
183184-----------------------185186Ready for more? Check out the :ref:`advanced <advanced>` section.189