From: Ian Cordasco Date: Sat, 17 Aug 2013 02:38:20 +0000 (-0500) Subject: Skip cookie extraction if necessary X-Git-Tag: v2.0~20^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98680b64f4ec679b788071d1811a2bdcbdd26ac9;p=services%2Fpython-requests.git Skip cookie extraction if necessary If _original_response is never set/is None, then don't try to extract cookies from the response. --- diff --git a/requests/cookies.py b/requests/cookies.py index 3bfedcc..f3ac64f 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: