返回提交历史
Modified
g4f/requests/__init__.py
+3
-5
XFEstudio/gpt4free
fix: update nodriver import to use zendriver and correct executable finder
0035bc47
代码差异
1 个文件
+3
-5
@@ -30,14 +30,12 @@ except ImportError:
30
30
try:
31
31
import zendriver as nodriver
32
32
from zendriver.cdp.network import CookieParam
33
from zendriver.core.config import find_chrome_executable
33
from zendriver.core.config import find_executable
34
34
from zendriver import Browser, Tab, util
35
36
35
has_nodriver = True
37
36
except ImportError:
38
37
from typing import Type as Browser
39
38
from typing import Type as Tab
40
41
39
has_nodriver = False
42
40
try:
43
41
from platformdirs import user_config_dir
@@ -166,13 +164,13 @@ async def get_nodriver(
166
164
) -> tuple[Browser, callable]:
167
165
if not has_nodriver:
168
166
raise MissingRequirementsError(
169
'Install "nodriver" and "platformdirs" package | pip install -U zendriver platformdirs')
167
'Install "zendriver" and "platformdirs" package | pip install -U zendriver platformdirs')
170
168
user_data_dir = user_config_dir(f"g4f-{user_data_dir}") if user_data_dir and has_platformdirs else None
171
169
if browser_executable_path is None:
172
170
browser_executable_path = BrowserConfig.browser_executable_path
173
171
if browser_executable_path is None:
174
172
try:
175
browser_executable_path = find_chrome_executable()
173
browser_executable_path = find_executable()
176
174
except FileNotFoundError:
177
175
# Default to Edge if Chrome is not available.
178
176
browser_executable_path = "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"