quickstart: using a list as a value in query params
authorTom S <scytale@gmail.com>
Tue, 3 Feb 2015 09:16:38 +0000 (09:16 +0000)
committerTom S <scytale@gmail.com>
Tue, 3 Feb 2015 09:19:30 +0000 (09:19 +0000)
docs/user/quickstart.rst

index b501b1b441eb97db61a3d22fa096654f24ef292e..febcf8ca2203a217a3a00c0bfeda4d4b72265075 100644 (file)
@@ -73,6 +73,13 @@ You can see that the URL has been correctly encoded by printing the URL::
 Note that any dictionary key whose value is ``None`` will not be added to the
 URL's query string.
 
+In order to pass a list of items as a value you must mark the key as
+referring to a list like string by appending ``[]`` to the key::
+
+    >>> payload = {'key1': 'value1', 'key2[]': ['value2', 'value3']}
+    >>> r = requests.get("http://httpbin.org/get", params=payload)
+    >>> print(r.url)
+    http://httpbin.org/get?key1=value1&key2%5B%5D=value2&key2%5B%5D=value3
 
 Response Content
 ----------------