Fixed finally. Also requires updated httpbin.org
authorIan Cordasco <graffatcolmingov@gmail.com>
Fri, 26 Jul 2013 15:50:19 +0000 (10:50 -0500)
committerIan Cordasco <graffatcolmingov@gmail.com>
Sun, 28 Jul 2013 03:07:25 +0000 (23:07 -0400)
requests/sessions.py
test_requests.py

index 664465d84bed5c696fb7f1523f03cc27bfdf134e..ca7e2170863481437ae72994d5686e9e1f7b5870 100644 (file)
@@ -449,6 +449,10 @@ class Session(SessionRedirectMixin):
         r = dispatch_hook('response', hooks, r, **kwargs)
 
         # Persist cookies
+        if r.history:
+            # If the hooks create history then we want those cookies too
+            for resp in r.history:
+                extract_cookies_to_jar(self.cookies, resp.request, resp.raw)
         extract_cookies_to_jar(self.cookies, request, r.raw)
 
         # Redirect resolving generator.
index 756bc87975c4146bf717a5a2409a51a13d1a2ae6..1c581066d93c2de924eea9c27c855e5b1d35741b 100755 (executable)
@@ -285,7 +285,7 @@ class RequestsTestCase(unittest.TestCase):
         self.assertEqual(r.status_code, 401)
 
         s = requests.session()
-        s.auth = auth
+        s.auth = HTTPDigestAuth('user', 'pass')
         r = s.get(url)
         self.assertEqual(r.status_code, 200)