From c008bf38836a2b5621ba7b352e9fcecacac4ee93 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Fri, 13 Jul 2018 11:44:25 +0200 Subject: [PATCH] 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. --- requests/api.py | 6 ++++-- 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 ` 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.