1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

aiohttp: Ignore cookie expiration date

This commit is contained in:
Paulo Romeira
2020-06-17 21:51:59 -03:00
committed by Kevin McCarthy
parent 20fb283e97
commit 1b9f80d741

View File

@@ -75,7 +75,13 @@ def build_response(vcr_request, vcr_response, history):
# cookies
for hdr in response.headers.getall(hdrs.SET_COOKIE, ()):
try:
response.cookies.load(hdr)
cookies = SimpleCookie(hdr)
for cookie_name, cookie in cookies.items():
expires = cookie.get('expires', '').strip()
if expires:
log.debug("Ignoring expiration date: %s=\"%s\"", cookie_name, expires)
cookie['expires'] = ''
response.cookies.load(cookie.output(header='').strip())
except CookieError as exc:
log.warning("Can not load response cookies: %s", exc)