From: Shrikant Sharat Date: Fri, 25 Nov 2011 03:02:07 +0000 (+0530) Subject: Add use_session argument to request method. X-Git-Tag: v0.8.3~11^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c72601599b085985f5b345717e8e8d127091c81;p=services%2Fpython-requests.git Add use_session argument to request method. This allows usage of an existing session to make a request with the request and the get, post etc. function. --- diff --git a/requests/api.py b/requests/api.py index 9e0c96f..21c7c7a 100644 --- a/requests/api.py +++ b/requests/api.py @@ -27,6 +27,7 @@ def request(method, url, hooks=None, return_response=True, prefetch=False, + use_session=None, config=None): """Constructs and sends a :class:`Request `. Returns :class:`Response ` object. @@ -43,10 +44,11 @@ def request(method, url, :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 use_session: (optional) A :class:`Session` object to be used for the request. :param config: (optional) A configuration dictionary. """ - s = session() + s = use_session or session() return s.request( method=method, url=url,