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
Provenance
- Commit
a49db50- Tree
0112a45- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent 1
0769ee3- Parent 2
bfef8d9
2 files changed+7 added−7 removed
modified:requests/api.py+4 added-4 removed
19 unmodified lines20 21 :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 lines73 def post(url, data=None, **kwargs):74 """Sends a POST request. Returns :class:`Response` object.75 76 :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 """80 81 return request('post', url, data=data, **kwargs)2 unmodified lines84 def put(url, data=None, **kwargs):85 """Sends a PUT request. Returns :class:`Response` object.86 87 :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 """91 92 return request('put', url, data=data, **kwargs)2 unmodified lines95 def patch(url, data=None, **kwargs):96 """Sends a PATCH request. Returns :class:`Response` object.97 98 :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 """102 103 return request('patch', url, data=data, **kwargs)10 unmodified linesmodified:requests/sessions.py+3 added-3 removed
314 unmodified lines315 def post(self, url, data=None, **kwargs):316 """Sends a POST request. Returns :class:`Response` object.317 318 :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 """322 323 return self.request('POST', url, data=data, **kwargs)1 unmodified line325 def put(self, url, data=None, **kwargs):326 """Sends a PUT request. Returns :class:`Response` object.327 328 :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 """332 333 return self.request('PUT', url, data=data, **kwargs)1 unmodified line335 def patch(self, url, data=None, **kwargs):336 """Sends a PATCH request. Returns :class:`Response` object.337 338 :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 """342 343 return self.request('PATCH', url, data=data, **kwargs)47 unmodified lines