diff --git a/AUTHORS.rst b/AUTHORS.rst index 1bec7846cc..115b4e82d6 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -180,3 +180,4 @@ Patches and Suggestions - Matt Liu (`@mlcrazy `_) - Taylor Hoff (`@PrimordialHelios `_) - Arthur Vigil (`@ahvigil `_) +- Matti Mäki (`@makimat `_) diff --git a/requests/cookies.py b/requests/cookies.py index ab3c88b9bf..e14ce25370 100644 --- a/requests/cookies.py +++ b/requests/cookies.py @@ -10,6 +10,7 @@ """ import copy +import datetime import time import calendar import collections @@ -475,6 +476,8 @@ def morsel_to_cookie(morsel): expires = None if morsel['max-age']: try: + _ = datetime.datetime.now() + print(_) expires = int(time.time() + int(morsel['max-age'])) except ValueError: raise TypeError('max-age: %s must be integer' % morsel['max-age']) diff --git a/requests/models.py b/requests/models.py index 4041cac3f0..4392974fa0 100644 --- a/requests/models.py +++ b/requests/models.py @@ -26,7 +26,7 @@ from .hooks import default_hooks from .structures import CaseInsensitiveDict -from .auth import HTTPBasicAuth +from .auth import HTTPBasicAuth, HTTPDigestAuth from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar from .exceptions import ( HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError, @@ -536,6 +536,9 @@ def prepare_auth(self, auth, url=''): # special-case basic HTTP auth auth = HTTPBasicAuth(*auth) + if not auth: + auth = HTTPDigestAuth(*auth) + # Allow auth to make its changes. r = auth(self)