diff --git a/requests/cookies.py b/requests/cookies.py index 3bfedcc4..f3ac64f0 100644 --- a/requests/cookies.py +++ b/requests/cookies.py @@ -107,6 +107,9 @@ def extract_cookies_to_jar(jar, request, response): :param request: our own requests.Request object :param response: urllib3.HTTPResponse object """ + if not (hasattr(response, '_original_response') and + response._original_response): + return # the _original_response field is the wrapped httplib.HTTPResponse object, req = MockRequest(request) # pull out the HTTPMessage with the headers and put it in the mock: