aboutsummaryrefslogtreecommitdiff
path: root/requests/api.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:41:19 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:41:19 -0700
commit365ef510aa3581a79709673e078401724601fc71 (patch)
tree44b2c6aae568684e93eb598d7a2069c1867fdaaf /requests/api.py
parent1c0a691ebf468d42b7c0d6b0e9daf0b2ff82cc20 (diff)
downloadpython-requests-365ef510aa3581a79709673e078401724601fc71.tar
python-requests-365ef510aa3581a79709673e078401724601fc71.tar.gz
Imported Upstream version 0.10.1
Diffstat (limited to 'requests/api.py')
-rw-r--r--requests/api.py47
1 files changed, 10 insertions, 37 deletions
diff --git a/requests/api.py b/requests/api.py
index 9e0c96f..b7d4158 100644
--- a/requests/api.py
+++ b/requests/api.py
@@ -6,28 +6,14 @@ requests.api
This module implements the Requests API.
-:copyright: (c) 2011 by Kenneth Reitz.
+:copyright: (c) 2012 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
-from .sessions import session
-
-
-def request(method, url,
- params=None,
- data=None,
- headers=None,
- cookies=None,
- files=None,
- auth=None,
- timeout=None,
- allow_redirects=False,
- proxies=None,
- hooks=None,
- return_response=True,
- prefetch=False,
- config=None):
+from . import sessions
+
+def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
Returns :class:`Response <Response>` object.
@@ -38,32 +24,19 @@ def request(method, url,
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
:param files: (optional) Dictionary of 'name': file-like-objects (or {'name': ('filename', fileobj)}) for multipart encoding upload.
- :param auth: (optional) Auth typle to enable Basic/Digest/Custom HTTP Auth.
+ :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) Float describing the timeout of the request.
:param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
:param return_response: (optional) If False, an un-sent Request object will returned.
+ :param session: (optional) A :class:`Session` object to be used for the request.
:param config: (optional) A configuration dictionary.
+ :param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided.
+ :param prefetch: (optional) if ``True``, the response content will be immediately downloaded.
"""
- s = session()
- return s.request(
- method=method,
- url=url,
- params=params,
- data=data,
- headers=headers,
- cookies=cookies,
- files=files,
- auth=auth,
- timeout=timeout,
- allow_redirects=allow_redirects,
- proxies=proxies,
- hooks=hooks,
- return_response=return_response,
- config=config,
- prefetch=prefetch
- )
+ s = kwargs.pop('session') if 'session' in kwargs else sessions.session()
+ return s.request(method=method, url=url, **kwargs)