Skip to content
Myr

cookies: Replace type checks with try/except

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michael Becker · committed by Michael Becker · parent 3984156 · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:requests/cookies.py+3 added-1 removed
381 unmodified lines
382 if morsel["max-age"]:383 expires = time.time() + morsel["max-age"]384 elif morsel['expires']:385 expires = morsel['expires']386 if type(expires) == type(""):386 try:387 time_template = "%a, %d-%b-%Y %H:%M:%S GMT"388 expires = time.mktime(time.strptime(expires, time_template))389 except TypeError:390 pass391 c = create_cookie(392 name=morsel.key,393 value=morsel.value,394 version=morsel['version'] or 0,
53 unmodified lines