diff options
author | Ian Cordasco <graffatcolmingov@gmail.com> | 2014-01-12 14:27:45 -0600 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2014-01-12 14:27:45 -0600 |
commit | 87abd9c6094f8b682f7457181adbe768d003fd23 (patch) | |
tree | c4c5642cfb35bd369deff926c90626422f67be79 | |
parent | ac4e05874a1a983ca126185a0e4d4e74915f792e (diff) | |
download | python-requests-fix-1859.tar.gz |
Use calendar.timegm when calculating cookie expirationfix-1859
Fixes #1859
Credit: @lukasa
-rw-r--r-- | requests/cookies.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/requests/cookies.py b/requests/cookies.py index 831c49c6..ea72f75e 100644 --- a/requests/cookies.py +++ b/requests/cookies.py @@ -7,6 +7,7 @@ requests.utils imports from here, so be careful with imports. """ import time +import calendar import collections from .compat import cookielib, urlparse, urlunparse, Morsel @@ -393,8 +394,8 @@ def morsel_to_cookie(morsel): expires = time.time() + morsel['max-age'] elif morsel['expires']: time_template = '%a, %d-%b-%Y %H:%M:%S GMT' - expires = time.mktime( - time.strptime(morsel['expires'], time_template)) - time.timezone + expires = calendar.timegm(time.strptime(morsel['expires'], + time_template)) return create_cookie( comment=morsel['comment'], comment_url=bool(morsel['comment']), |