Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Workaround for large expire timestamps in cookies #731

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions seleniumwire/har.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
import base64
import json
from datetime import datetime, timezone
from datetime import datetime, timedelta, timezone
from typing import List, Set

import seleniumwire
Expand Down Expand Up @@ -139,7 +139,8 @@ def _format_cookies(cookie_list):
# Expiration time needs to be formatted
expire_ts = cookies.get_expiration_ts(attrs)
if expire_ts is not None:
cookie_har["expires"] = datetime.fromtimestamp(expire_ts, timezone.utc).isoformat()
expire = datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=expire_ts)
cookie_har["expires"] = expire.isoformat()

rv.append(cookie_har)

Expand Down