Merge pull request #4739 from moy/doc-list-of-tuples
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Document that params and data can be list of tuples everywhere
authored by Nate Prewitt · committed by GitHub · parents f6e13cc, c008bf3 · Browse files · 3 files·+26 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+26 added−13 removed
- other:+26 added−13 removed
Provenance
- Commit
5aeec8b- Tree
577d5c0- Author
Nate Prewitt <nate.prewitt@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
f6e13cc- Parent 2
c008bf3
3 files changed+26 added−13 removed
modified:requests/api.py+12 added-6 removed
16 unmodified lines17 """Constructs and sends a :class:`Request <Request>`.18 19 :param method: method for the new :class:`Request` object.20 :param url: URL for the new :class:`Request` object.21- :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.22- :param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.21+ :param params: (optional) Dictionary, list of tuples or bytes to send22+ in the body of the :class:`Request`.23+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like24+ object to send in the body of the :class:`Request`.25 :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.26 :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.27 :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.28 :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.34 unmodified lines63 def get(url, params=None, **kwargs):64 r"""Sends a GET request.65 66 :param url: URL for the new :class:`Request` object.65- :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.67+ :param params: (optional) Dictionary, list of tuples or bytes to send68+ in the body of the :class:`Request`.69 :param \*\*kwargs: Optional arguments that ``request`` takes.70 :return: :class:`Response <Response>` object71 :rtype: requests.Response72 """31 unmodified lines104 def post(url, data=None, json=None, **kwargs):105 r"""Sends a POST request.106 107 :param url: URL for the new :class:`Request` object.105- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.108+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like109+ object to send in the body of the :class:`Request`.110 :param json: (optional) json data to send in the body of the :class:`Request`.111 :param \*\*kwargs: Optional arguments that ``request`` takes.112 :return: :class:`Response <Response>` object113 :rtype: requests.Response5 unmodified lines119 def put(url, data=None, **kwargs):120 r"""Sends a PUT request.121 122 :param url: URL for the new :class:`Request` object.119- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.123+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like124+ object to send in the body of the :class:`Request`.125 :param json: (optional) json data to send in the body of the :class:`Request`.126 :param \*\*kwargs: Optional arguments that ``request`` takes.127 :return: :class:`Response <Response>` object128 :rtype: requests.Response5 unmodified lines134 def patch(url, data=None, **kwargs):135 r"""Sends a PATCH request.136 137 :param url: URL for the new :class:`Request` object.133- :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.138+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like139+ object to send in the body of the :class:`Request`.140 :param json: (optional) json data to send in the body of the :class:`Request`.141 :param \*\*kwargs: Optional arguments that ``request`` takes.142 :return: :class:`Response <Response>` object143 :rtype: requests.Response15 unmodified linesmodified:requests/models.py+6 added-2 removed
202 unmodified lines203 :param method: HTTP method to use.204 :param url: URL to send.205 :param headers: dictionary of headers to send.206 :param files: dictionary of {filename: fileobject} files to multipart upload.207- :param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.207+ :param data: the body to attach to the request. If a dictionary or208+ list of tuples ``[(key, value)]`` is provided, form-encoding will209+ take place.210 :param json: json for the body to attach to the request (if files or data is not specified).209- :param params: dictionary of URL parameters to append to the URL.211+ :param params: URL parameters to append to the URL. If a dictionary or212+ list of tuples ``[(key, value)]`` is provided, form-encoding will213+ take place.214 :param auth: Auth handler or (user, pass) tuple.215 :param cookies: dictionary or CookieJar of cookies to attach to this request.216 :param hooks: dictionary of callback hooks, for internal usage.217 739 unmodified linesmodified:requests/sessions.py+8 added-5 removed
451 unmodified lines452 :param method: method for the new :class:`Request` object.453 :param url: URL for the new :class:`Request` object.454 :param params: (optional) Dictionary or bytes to be sent in the query455 string for the :class:`Request`.456- :param data: (optional) Dictionary, bytes, or file-like object to send457- in the body of the :class:`Request`.456+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like457+ object to send in the body of the :class:`Request`.458 :param json: (optional) json to send in the body of the459 :class:`Request`.460 :param headers: (optional) Dictionary of HTTP Headers to send with the461 :class:`Request`.87 unmodified lines549 def post(self, url, data=None, json=None, **kwargs):550 r"""Sends a POST request. Returns :class:`Response` object.551 552 :param url: URL for the new :class:`Request` object.553- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.553+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like554+ object to send in the body of the :class:`Request`.555 :param json: (optional) json to send in the body of the :class:`Request`.556 :param \*\*kwargs: Optional arguments that ``request`` takes.557 :rtype: requests.Response558 """3 unmodified lines562 def put(self, url, data=None, **kwargs):563 r"""Sends a PUT request. Returns :class:`Response` object.564 565 :param url: URL for the new :class:`Request` object.565- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.566+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like567+ object to send in the body of the :class:`Request`.568 :param \*\*kwargs: Optional arguments that ``request`` takes.569 :rtype: requests.Response570 """571 2 unmodified lines574 def patch(self, url, data=None, **kwargs):575 r"""Sends a PATCH request. Returns :class:`Response` object.576 577 :param url: URL for the new :class:`Request` object.576- :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.578+ :param data: (optional) Dictionary, list of tuples, bytes, or file-like579+ object to send in the body of the :class:`Request`.580 :param \*\*kwargs: Optional arguments that ``request`` takes.581 :rtype: requests.Response582 """583 166 unmodified lines