Add quickstart doc and example for passing parameters in a GET request
authorJonathan Drosdeck <Jon.Drosdeck@mmerch.com>
Sun, 18 Mar 2012 19:37:46 +0000 (15:37 -0400)
committerJonathan Drosdeck <Jon.Drosdeck@mmerch.com>
Sun, 18 Mar 2012 19:37:46 +0000 (15:37 -0400)
AUTHORS.rst
docs/user/quickstart.rst

index c3d5005aec69c77d7ee64683ba028f06106aecde..243033fbfc81ad470f1a6b2a5bf3c57289f95337 100644 (file)
@@ -89,3 +89,4 @@ Patches and Suggestions
 - Danver Braganza <danverbraganza@gmail.com>
 - Max Countryman
 - Nick Chadwick
+- Jonathan Drosdeck
\ No newline at end of file
index 3202ee67549148c0079046423faf144ae5f829a4..70ec5f13183e019660819402dd6f30487e1983bd 100644 (file)
@@ -30,6 +30,32 @@ Let's get GitHub's public timeline ::
 Now, we have a :class:`Response` object called ``r``. We can get all the
 information we need from this.
 
+Typically, you want to send some sort of data in the urls query string.
+To do this, simply pass a dictionary to the `params` argument. Your
+dictionary of data will automatically be encoded when the request is made::
+
+    >>> payload = {'key1': 'value1', 'key2': 'value2'}
+    >>> r = requests.get("http://httpbin.org/get", params=payload)
+    >>> print r.text
+    {
+      "origin": "179.13.100.4",
+      "args": {
+        "key2": "value2",
+        "key1": "value1"
+      },
+      "url": "http://httpbin.org/get",
+      "headers": {
+        "Connections": "keep-alive",
+        "Content-Length": "",
+        "Accept-Encoding": "identity, deflate, compress, gzip",
+        "Accept": "*/*",
+        "User-Agent": "python-requests/0.11.0",
+        "Host": httpbin.org",
+        "Content-Type": ""
+      },
+    }
+
+
 
 Response Content
 ----------------