Allow mixing sessions and async.
authorHank Gay <whg@us.ibm.com>
Tue, 17 Jan 2012 16:24:50 +0000 (11:24 -0500)
committerHank Gay <whg@us.ibm.com>
Tue, 17 Jan 2012 16:44:59 +0000 (11:44 -0500)
requests/models.py

index c45b18a..b7fe844 100644 (file)
@@ -57,7 +57,8 @@ class Request(object):
         hooks=None,
         config=None,
         _poolmanager=None,
-        verify=None):
+        verify=None,
+        session=None):
 
         #: Float describes the timeout of the request.
         #  (Use socket.setdefaulttimeout() as fallback)
@@ -116,7 +117,7 @@ class Request(object):
         self.hooks = hooks
 
         #: Session.
-        self.session = None
+        self.session = session
 
         #: SSL Verification.
         self.verify = verify
@@ -246,7 +247,8 @@ class Request(object):
                     timeout=self.timeout,
                     _poolmanager=self._poolmanager,
                     proxies = self.proxies,
-                    verify = self.verify
+                    verify = self.verify,
+                    session = self.session
                 )
 
                 request.send()