Container commited on
Commit
19f5db9
·
verified ·
1 Parent(s): b721dbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -37,7 +37,7 @@ def main():
37
  return {"code": 200,"msg":"Success"}
38
 
39
  @app.get("/chrome")
40
- def chrome(url:str=None,wait:int=5,header:str=None,cookie:str=None):
41
  # 开启捕获HAR数据功能,允许使用 driver.har 进行检索
42
  seleniumwire_options = {
43
  'enable_har': True
@@ -93,6 +93,8 @@ def chrome(url:str=None,wait:int=5,header:str=None,cookie:str=None):
93
  del header_array['cookie']
94
  for key, value in cookie_array.items():
95
  try:
 
 
96
  driver.add_cookie({"name": key, "value": quote(value), "domain": f'.{target_domain}', "path": "/"})
97
  except Exception as e:
98
  print("Error Cookie:")
 
37
  return {"code": 200,"msg":"Success"}
38
 
39
  @app.get("/chrome")
40
+ def chrome(url:str=None,wait:int=5,header:str=None,cookie:str=None,cookie_domain:str=None):
41
  # 开启捕获HAR数据功能,允许使用 driver.har 进行检索
42
  seleniumwire_options = {
43
  'enable_har': True
 
93
  del header_array['cookie']
94
  for key, value in cookie_array.items():
95
  try:
96
+ if cookie_domain :
97
+ target_domain = cookie_domain
98
  driver.add_cookie({"name": key, "value": quote(value), "domain": f'.{target_domain}', "path": "/"})
99
  except Exception as e:
100
  print("Error Cookie:")