summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/helper.py
diff options
context:
space:
mode:
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.