BG5 commited on
Commit
a5f3ad8
·
verified ·
1 Parent(s): 943d906

Update api.txt

Browse files
Files changed (1) hide show
  1. api.txt +3 -3
api.txt CHANGED
@@ -367,7 +367,7 @@ async def open_browser(request: Request):
367
  error_data = {"success": False, "msg": f"chrome端口{port}未就绪", "data": {}}
368
  return encrypt_json_response(error_data)
369
  async with httpx.AsyncClient() as client:
370
- resp = await client.get(f"http:#127.0.0.1:{port}/json/version")
371
  if resp.status_code == 200:
372
  browser_info = resp.json()
373
  ws_url = browser_info.get("webSocketDebuggerUrl").replace("ws:#127.0.0.1", "wss:#0.0.0.0")
@@ -523,7 +523,7 @@ async def find_browser_by_target_id(tab_type,target_id: str):
523
  # 尝试获取浏览器的页面列表
524
  port = browser["port"]
525
  async with httpx.AsyncClient() as client:
526
- resp = await client.get(f"http:#127.0.0.1:{port}/json/list")
527
  if resp.status_code == 200:
528
  pages = resp.json()
529
  # 检查页面是否包含 target_id
@@ -557,7 +557,7 @@ async def cdp_native_proxy(request: Request):
557
  port = b["port"]
558
  # 2. 构造目标URL
559
  path = request.url.path
560
- url = f"http:#127.0.0.1:{port}{path}"
561
  # 3. 代理请求
562
  headers = dict(request.headers)
563
  headers["host"] = "127.0.0.1"
 
367
  error_data = {"success": False, "msg": f"chrome端口{port}未就绪", "data": {}}
368
  return encrypt_json_response(error_data)
369
  async with httpx.AsyncClient() as client:
370
+ resp = await client.get(f"http://127.0.0.1:{port}/json/version")
371
  if resp.status_code == 200:
372
  browser_info = resp.json()
373
  ws_url = browser_info.get("webSocketDebuggerUrl").replace("ws:#127.0.0.1", "wss:#0.0.0.0")
 
523
  # 尝试获取浏览器的页面列表
524
  port = browser["port"]
525
  async with httpx.AsyncClient() as client:
526
+ resp = await client.get(f"http://127.0.0.1:{port}/json/list")
527
  if resp.status_code == 200:
528
  pages = resp.json()
529
  # 检查页面是否包含 target_id
 
557
  port = b["port"]
558
  # 2. 构造目标URL
559
  path = request.url.path
560
+ url = f"http://127.0.0.1:{port}{path}"
561
  # 3. 代理请求
562
  headers = dict(request.headers)
563
  headers["host"] = "127.0.0.1"