aiohttp: Ignore cookie expiration date
@@ -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)
