Skip to content
Myr

Add quickstart doc and example for passing parameters in a GET request

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

authored by Jonathan Drosdeck · committed by Jonathan Drosdeck · parent 9cf9d76 · Browse files · 2 files+27 added−0 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+27 added−0 removed

  • other:+27 added−0 removed

2 files+27 added−0 removed

modified:docs/user/quickstart.rst+26 added
28 unmodified lines
2930Now, we have a :class:`Response` object called ``r``. We can get all the31information we need from this.3233Typically, you want to send some sort of data in the urls query string.34To do this, simply pass a dictionary to the `params` argument. Your35dictionary of data will automatically be encoded when the request is made::3637 >>> payload = {'key1': 'value1', 'key2': 'value2'}38 >>> r = requests.get("http://httpbin.org/get", params=payload)39 >>> print r.text40 {41 "origin": "179.13.100.4",42 "args": {43 "key2": "value2",44 "key1": "value1"45 },46 "url": "http://httpbin.org/get",47 "headers": {48 "Connections": "keep-alive",49 "Content-Length": "",50 "Accept-Encoding": "identity, deflate, compress, gzip",51 "Accept": "*/*",52 "User-Agent": "python-requests/0.11.0",53 "Host": httpbin.org",54 "Content-Type": ""55 },56 }57585960Response Content61----------------6263We can read the content of the server's response::
369 unmodified lines
modified:AUTHORS.rst+1 added
87 unmodified lines
88- Chris Dary89- Danver Braganza <danverbraganza@gmail.com>90- Max Countryman91- Nick Chadwick92- Jonathan Drosdeck