diff --git a/requests/adapters.py b/requests/adapters.py index 10ed2515..ccca4beb 100644 --- a/requests/adapters.py +++ b/requests/adapters.py @@ -20,6 +20,7 @@ from .packages.urllib3.exceptions import SSLError as _SSLError from .packages.urllib3.exceptions import HTTPError as _HTTPError from .packages.urllib3 import connectionpool, poolmanager from .packages.urllib3.filepost import encode_multipart_formdata +from .cookies import extract_cookies_to_jar from .exceptions import ( ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects, URLRequired, SSLError, MissingSchema, InvalidSchema, InvalidURL) @@ -109,10 +110,10 @@ class HTTPAdapter(BaseAdapter): else: response.url = req.url - return response # Add new cookies from the server. - # extract_cookies_to_jar(self.cookies, self, resp) + extract_cookies_to_jar(response.cookies, req, resp) + return response def close(self): diff --git a/requests/models.py b/requests/models.py index 46728008..f964a671 100644 --- a/requests/models.py +++ b/requests/models.py @@ -385,10 +385,7 @@ class Response(object): self.reason = None #: A CookieJar of Cookies the server sent back. - self.cookies = None - - #: Dictionary of configurations for this request. - self.config = {} + self.cookies = cookiejar_from_dict({}) def __repr__(self): return '' % (self.status_code)