summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/helper.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-26 12:49:52 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-26 12:49:52 +0100
commit1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b (patch)
tree845e5d27d9f94c16215da60aaee0ad36f5a35344 /g4f/Provider/helper.py
parentNew minimum requirements (#1515) (diff)
downloadgpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.gz
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.bz2
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.lz
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.xz
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.zst
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/helper.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/g4f/Provider/helper.py b/g4f/Provider/helper.py
index 0af61d8d..87fdb158 100644
--- a/g4f/Provider/helper.py
+++ b/g4f/Provider/helper.py
@@ -21,7 +21,7 @@ try:
except ImportError:
has_browser_cookie3 = False
-from ..typing import Dict, Messages, Optional
+from ..typing import Dict, Messages, Cookies, Optional
from ..errors import AiohttpSocksError, MissingRequirementsError
from .. import debug
@@ -48,6 +48,12 @@ def get_cookies(domain_name: str = '', raise_requirements_error: bool = True) ->
_cookies[domain_name] = cookies
return cookies
+def set_cookies(domain_name: str, cookies: Cookies = None) -> None:
+ if cookies:
+ _cookies[domain_name] = cookies
+ else:
+ _cookies.pop(domain_name)
+
def load_cookies_from_browsers(domain_name: str, raise_requirements_error: bool = True) -> Dict[str, str]:
"""
Helper function to load cookies from various browsers.