Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,4 @@ Patches and Suggestions
- Matt Liu <liumatt@gmail.com> (`@mlcrazy <https://github.com/mlcrazy>`_)
- Taylor Hoff <primdevs@protonmail.com> (`@PrimordialHelios <https://github.com/PrimordialHelios>`_)
- Arthur Vigil (`@ahvigil <https://github.com/ahvigil>`_)
- Matti Mäki (`@makimat <https://github.com/makimat>`_)
3 changes: 3 additions & 0 deletions requests/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import copy
import datetime
import time
import calendar
import collections
Expand Down Expand Up @@ -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'])
Expand Down
5 changes: 4 additions & 1 deletion requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down