Skip to content

Commit

Permalink
Merge pull request #2437 from tomscytale/docs_query_param_array
Browse files Browse the repository at this point in the history
quickstart: using a list as a value in query params
  • Loading branch information
Lukasa committed Feb 3, 2015
2 parents 69b7c45 + 53f33eb commit c7beb70
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------
Expand Down

0 comments on commit c7beb70

Please sign in to comment.