summaryrefslogtreecommitdiffstats
path: root/g4f/cookies.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-11 08:41:54 +0100
committerGitHub <noreply@github.com>2024-02-11 08:41:54 +0100
commit3c498496f812b252d65b65690c36e5f2aa133b94 (patch)
tree6b46c5cc3671f0e1f4fcdab7e92050b3713d466c /g4f/cookies.py
parentUpdate image.py (diff)
parentChange python version to 3.12 in unitests (diff)
downloadgpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.tar
gpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.tar.gz
gpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.tar.bz2
gpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.tar.lz
gpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.tar.xz
gpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.tar.zst
gpt4free-3c498496f812b252d65b65690c36e5f2aa133b94.zip
Diffstat (limited to 'g4f/cookies.py')
-rw-r--r--g4f/cookies.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/g4f/cookies.py b/g4f/cookies.py
index af0e6192..a38488c2 100644
--- a/g4f/cookies.py
+++ b/g4f/cookies.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import os
+import time
try:
from platformdirs import user_config_dir
@@ -72,7 +73,8 @@ def load_cookies_from_browsers(domain_name: str, raise_requirements_error: bool
print(f"Read cookies from {cookie_fn.__name__} for {domain_name}")
for cookie in cookie_jar:
if cookie.name not in cookies:
- cookies[cookie.name] = cookie.value
+ if not cookie.expires or cookie.expires > time.time():
+ cookies[cookie.name] = cookie.value
if single_browser and len(cookie_jar):
break
except BrowserCookieError: