summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/helper.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2023-12-06 12:02:41 +0100
committerGitHub <noreply@github.com>2023-12-06 12:02:41 +0100
commitf962993b8dac225d85f9fbb59be188e263af1c0b (patch)
treeae153b027ad5a2679b4f1fde881d61cc0e1276b4 /g4f/Provider/helper.py
parent~ | g4f `v-0.1.9.1` (diff)
parentImprove docker image (diff)
downloadgpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.tar
gpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.tar.gz
gpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.tar.bz2
gpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.tar.lz
gpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.tar.xz
gpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.tar.zst
gpt4free-f962993b8dac225d85f9fbb59be188e263af1c0b.zip
Diffstat (limited to 'g4f/Provider/helper.py')
-rw-r--r--g4f/Provider/helper.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/g4f/Provider/helper.py b/g4f/Provider/helper.py
index 2171f0b7..61d9cb62 100644
--- a/g4f/Provider/helper.py
+++ b/g4f/Provider/helper.py
@@ -6,6 +6,7 @@ import webbrowser
import random
import string
import secrets
+import os
from os import path
from asyncio import AbstractEventLoop
from platformdirs import user_config_dir
@@ -18,7 +19,7 @@ from browser_cookie3 import (
edge,
vivaldi,
firefox,
- BrowserCookieError
+ _LinuxPasswordManager
)
from ..typing import Dict, Messages
@@ -81,6 +82,10 @@ def init_cookies():
except webbrowser.Error:
continue
+# Check for broken dbus address in docker image
+if os.environ.get('DBUS_SESSION_BUS_ADDRESS') == "/dev/null":
+ _LinuxPasswordManager.get_password = lambda a, b: b"secret"
+
# Load cookies for a domain from all supported browsers.
# Cache the results in the "_cookies" variable.
def get_cookies(domain_name=''):
@@ -100,7 +105,7 @@ def get_cookies(domain_name=''):
for cookie in cookie_jar:
if cookie.name not in cookies:
cookies[cookie.name] = cookie.value
- except BrowserCookieError as e:
+ except:
pass
_cookies[domain_name] = cookies
return _cookies[domain_name]