summaryrefslogtreecommitdiffstats
path: root/g4f/cookies.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-11 01:59:57 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-11 01:59:57 +0100
commit6c422b2965d07e33a4c03fd7e1963316500bd527 (patch)
tree852bda60253d7dacf020c819362918b8fb426b48 /g4f/cookies.py
parentUpdate image.py (diff)
downloadgpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.tar
gpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.tar.gz
gpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.tar.bz2
gpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.tar.lz
gpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.tar.xz
gpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.tar.zst
gpt4free-6c422b2965d07e33a4c03fd7e1963316500bd527.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: