diff options
author | Christopher Baines <mail@cbaines.net> | 2015-12-22 13:47:07 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2015-12-22 13:48:06 +0000 |
commit | 79f51e45f74dd32f9c1a103150ded9d575f5f94c (patch) | |
tree | adcea8da78181c97b46d4483657877b2b348833a /requests/cookies.py | |
parent | 59759b30c8a8f23377afe562a44ddc893dbbb833 (diff) | |
parent | 08c16e06ad11c6fcb26f4ca1ea3f11093598092f (diff) | |
download | python-requests-79f51e45f74dd32f9c1a103150ded9d575f5f94c.tar python-requests-79f51e45f74dd32f9c1a103150ded9d575f5f94c.tar.gz |
change version to 2.9.1-1 (UNRELEASED)
New upstream release 2.9.1
Diffstat (limited to 'requests/cookies.py')
-rw-r--r-- | requests/cookies.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/requests/cookies.py b/requests/cookies.py index 88b478c..b85fd2b 100644 --- a/requests/cookies.py +++ b/requests/cookies.py @@ -8,6 +8,7 @@ requests.utils imports from here, so be careful with imports. import copy import time +import calendar import collections from .compat import cookielib, urlparse, urlunparse, Morsel @@ -143,10 +144,13 @@ def remove_cookie_by_name(cookiejar, name, domain=None, path=None): """ clearables = [] for cookie in cookiejar: - if cookie.name == name: - if domain is None or domain == cookie.domain: - if path is None or path == cookie.path: - clearables.append((cookie.domain, cookie.path, cookie.name)) + if cookie.name != name: + continue + if domain is not None and domain != cookie.domain: + continue + if path is not None and path != cookie.path: + continue + clearables.append((cookie.domain, cookie.path, cookie.name)) for domain, path, name in clearables: cookiejar.clear(domain, path, name) @@ -365,7 +369,7 @@ def _copy_cookie_jar(jar): return None if hasattr(jar, 'copy'): - # We're dealing with an instane of RequestsCookieJar + # We're dealing with an instance of RequestsCookieJar return jar.copy() # We're dealing with a generic CookieJar instance new_jar = copy.copy(jar) @@ -421,8 +425,9 @@ def morsel_to_cookie(morsel): raise TypeError('max-age: %s must be integer' % morsel['max-age']) elif morsel['expires']: time_template = '%a, %d-%b-%Y %H:%M:%S GMT' - expires = int(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']), |