diff options
| author | Matthieu Moy <git@matthieu-moy.fr> | 2018-07-13 11:44:25 +0200 |
|---|---|---|
| committer | Matthieu Moy <git@matthieu-moy.fr> | 2018-07-17 18:55:55 +0200 |
| commit | c008bf38836a2b5621ba7b352e9fcecacac4ee93 (patch) | |
| tree | 577d5c09e9a81e162dff7072bf3fb8ccbf3cdf62 | |
| parent | 2d1b4482c5916433a642d66c6b3d0cd28058b39e (diff) | |
| download | python-requests-c008bf38836a2b5621ba7b352e9fcecacac4ee93.tar.gz | |
Document that 'params' can also be a list of tuples
Like we just did for 'data', 'params' follows the same processing and
can also be a list of tuples.
| -rw-r--r-- | requests/api.py | 6 | ||||
| -rw-r--r-- | requests/models.py | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/requests/api.py b/requests/api.py index 5f4f8f1e..5f07a19f 100644 --- a/requests/api.py +++ b/requests/api.py @@ -18,7 +18,8 @@ def request(method, url, **kwargs): :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. - :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the body of the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. @@ -63,7 +64,8 @@ def get(url, params=None, **kwargs): r"""Sends a GET request. :param url: URL for the new :class:`Request` object. - :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response diff --git a/requests/models.py b/requests/models.py index af62c401..086e03c1 100644 --- a/requests/models.py +++ b/requests/models.py @@ -208,7 +208,9 @@ class Request(RequestHooksMixin): list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param json: json for the body to attach to the request (if files or data is not specified). - :param params: dictionary of URL parameters to append to the URL. + :param params: URL parameters to append to the URL. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. :param auth: Auth handler or (user, pass) tuple. :param cookies: dictionary or CookieJar of cookies to attach to this request. :param hooks: dictionary of callback hooks, for internal usage. |
