Skip to content
Myr

Merge pull request #1052 from hozn/apidocs-tweak

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Small tweak to API docs to indicate that file-like object supported for data param.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 0769ee3, bfef8d9 · Browse files · 2 files+7 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−7 removed

  • other:+7 added−7 removed

2 files+7 added−7 removed

modified:requests/api.py+4 added-4 removed
19 unmodified lines
2021 :param method: method for the new :class:`Request` object.22 :param url: URL for the new :class:`Request` object.23 :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.24 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.24 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.25 :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.26 :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.27 :param files: (optional) Dictionary of 'name': file-like-objects (or {'name': ('filename', fileobj)}) for multipart encoding upload.28 :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
44 unmodified lines
73def post(url, data=None, **kwargs):74 """Sends a POST request. Returns :class:`Response` object.7576 :param url: URL for the new :class:`Request` object.77 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.77 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.78 :param \*\*kwargs: Optional arguments that ``request`` takes.79 """8081 return request('post', url, data=data, **kwargs)
2 unmodified lines
84def put(url, data=None, **kwargs):85 """Sends a PUT request. Returns :class:`Response` object.8687 :param url: URL for the new :class:`Request` object.88 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.88 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.89 :param \*\*kwargs: Optional arguments that ``request`` takes.90 """9192 return request('put', url, data=data, **kwargs)
2 unmodified lines
95def patch(url, data=None, **kwargs):96 """Sends a PATCH request. Returns :class:`Response` object.9798 :param url: URL for the new :class:`Request` object.99 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.99 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.100 :param \*\*kwargs: Optional arguments that ``request`` takes.101 """102103 return request('patch', url, data=data, **kwargs)
10 unmodified lines
modified:requests/sessions.py+3 added-3 removed
314 unmodified lines
315 def post(self, url, data=None, **kwargs):316 """Sends a POST request. Returns :class:`Response` object.317318 :param url: URL for the new :class:`Request` object.319 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.319 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.320 :param \*\*kwargs: Optional arguments that ``request`` takes.321 """322323 return self.request('POST', url, data=data, **kwargs)
1 unmodified line
325 def put(self, url, data=None, **kwargs):326 """Sends a PUT request. Returns :class:`Response` object.327328 :param url: URL for the new :class:`Request` object.329 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.329 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.330 :param \*\*kwargs: Optional arguments that ``request`` takes.331 """332333 return self.request('PUT', url, data=data, **kwargs)
1 unmodified line
335 def patch(self, url, data=None, **kwargs):336 """Sends a PATCH request. Returns :class:`Response` object.337338 :param url: URL for the new :class:`Request` object.339 :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.339 :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.340 :param \*\*kwargs: Optional arguments that ``request`` takes.341 """342343 return self.request('PATCH', url, data=data, **kwargs)
47 unmodified lines