Conform api.* arguments to api.request arguments.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Fixes #40. Fixes #41.
authored by Johannes · committed by Johannes · parent 7e3d265 · Browse files · 1 file·+16 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+16 added−10 removed
- other:+16 added−10 removed
Provenance
- Commit
9b2d738- Tree
65cb846- Author
Johannes <jgorset@gmail.com>- Committer
Johannes <jgorset@gmail.com>- Parent
7e3d265
1 file changed+16 added−10 removed
modified:requests/api.py+16 added-10 removed
51 unmodified lines52 r.send()53 54 return r.response55 56-def get(url, params={}, headers={}, cookies=None, auth=None, **kwargs):56+def get(url, params=None, headers=None, cookies=None, auth=None, timeout=None):57 """Sends a GET request. Returns :class:`Response` object.58 59 :param url: URL for the new :class:`Request` object.60 :param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.2 unmodified lines63 :param auth: (optional) AuthObject to enable Basic HTTP Auth.64 :param timeout: (optional) Float describing the timeout of the request.65 """66 67- return request('GET', url, params=params, headers=headers, cookies=cookies, auth=auth, **kwargs)67+ return request('GET', url, params=params, headers=headers, cookies=cookies, auth=auth, timeout=timeout)68 69 70-def head(url, params={}, headers={}, cookies=None, auth=None, **kwargs):70+def head(url, params=None, headers=None, cookies=None, auth=None, timeout=None):71 """Sends a HEAD request. Returns :class:`Response` object.72 73 :param url: URL for the new :class:`Request` object.74 :param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.2 unmodified lines77 :param auth: (optional) AuthObject to enable Basic HTTP Auth.78 :param timeout: (optional) Float describing the timeout of the request.79 """80 81- return request('HEAD', url, params=params, headers=headers, cookies=cookies, auth=auth, **kwargs)81+ return request('HEAD', url, params=params, headers=headers, cookies=cookies, auth=auth, timeout=timeout)82 83 84-def post(url, data={}, headers={}, files=None, cookies=None, auth=None, **kwargs):84+def post(url, data=None, headers=None, files=None, cookies=None, auth=None, timeout=None, allow_redirects=False):85 """Sends a POST request. Returns :class:`Response` object.86 87 :param url: URL for the new :class:`Request` object.88 :param data: (optional) Dictionary of POST data to send with the :class:`Request`.1 unmodified line90 :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.91 :param cookies: (optional) CookieJar object to send with the :class:`Request`.92 :param auth: (optional) AuthObject to enable Basic HTTP Auth.93 :param timeout: (optional) Float describing the timeout of the request.94+ :param allow_redirects: (optional) Boolean. Set to True if redirect following is allowed.95 """96 96- return request('POST', url, data=data, headers=headers, files=files, cookies=cookies, auth=auth, **kwargs)97+ return request('POST', url, data=data, headers=headers, files=files, cookies=cookies, auth=auth,98+ timeout=timeout, allow_redirects=allow_redirects)99 100 99-def put(url, data='', headers={}, files={}, cookies=None, auth=None, **kwargs):101+def put(url, data=None, headers=None, files=None, cookies=None, auth=None, timeout=None, allow_redirects=False):102 """Sends a PUT request. Returns :class:`Response` object.103 104 :param url: URL for the new :class:`Request` object.105 :param params: (optional) Bytes of PUT Data to send with the :class:`Request`.1 unmodified line107 :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.108 :param cookies: (optional) CookieJar object to send with the :class:`Request`.109 :param auth: (optional) AuthObject to enable Basic HTTP Auth.110 :param timeout: (optional) Float describing the timeout of the request.111+ :param allow_redirects: (optional) Boolean. Set to True if redirect following is allowed.112 """113 111- return request('PUT', url, data=data, headers=headers, files=files, cookies=cookies, auth=auth, **kwargs)114+ return request('PUT', url, data=data, headers=headers, files=files, cookies=cookies, auth=auth,115+ timeout=timeout, allow_redirects=allow_redirects)116 117 114-def delete(url, params={}, headers={}, cookies=None, auth=None, **kwargs):118+def delete(url, params=None, headers=None, cookies=None, auth=None, timeout=None, allow_redirects=False):119 """Sends a DELETE request. Returns :class:`Response` object.120 121 :param url: URL for the new :class:`Request` object.122 :param params: (optional) Dictionary of DELETE Parameters to send with the :class:`Request`.123 :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.124 :param cookies: (optional) CookieJar object to send with the :class:`Request`.125 :param auth: (optional) AuthObject to enable Basic HTTP Auth.126 :param timeout: (optional) Float describing the timeout of the request.127+ :param allow_redirects: (optional) Boolean. Set to True if redirect following is allowed.128 """129 125- return request('DELETE', url, params=params, headers=headers, cookies=cookies, auth=auth, **kwargs)130+ return request('DELETE', url, params=params, headers=headers, cookies=cookies, auth=auth,131+ timeout=timeout, allow_redirects=allow_redirects)