XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Update cdp.py

52d1a412
H Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +7 -0
Modified g4f/requests/cdp.py +7 -0
@@ -164,6 +164,13 @@ def get_shared_browser(host: str, preferred_port: int, headless: bool = True) ->
164 164 global _shared_browser_process, _shared_browser_port
165 165
166 166 with _shared_browser_lock:
167 if preferred_port is not None:
168 try:
169 with urllib.request.urlopen(f"http://{host}:{preferred_port}/json", timeout=0.5) as response:
170 if response.status == 200:
171 return preferred_port
172 except Exception:
173 pass
167 174 # 1. If we already started a shared browser in this thread, check if it's still alive/reachable
168 175 if _shared_browser_port is not None:
169 176 try: