isrpa 1.0.2__py3-none-any.whl → 1.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
isrpa/utils.py CHANGED
@@ -27,14 +27,19 @@ def getPath(user_name):
27
27
  if response.status_code != 200:
28
28
  return "failure"
29
29
  port = response.json()
30
- url = f"http://localhost:{port}/json/version"
31
- response = requests.get(url)
32
- if response.status_code != 200:
33
- return "failure"
34
- return response.json().get('webSocketDebuggerUrl')
30
+
31
+ def get_ws_url():
32
+ url = f"http://localhost:{port}/json/version"
33
+ response = requests.get(url)
34
+ if response.status_code != 200:
35
+ return "failure"
36
+ return response.json().get('webSocketDebuggerUrl')
37
+
38
+ ws_url = get_ws_url()
39
+ return ws_url
35
40
 
36
41
 
37
- def get_active_page(browser, user_name):
42
+ def get_active_url(user_name):
38
43
  """
39
44
  获取当前激活page对象
40
45
  """
@@ -45,17 +50,28 @@ def get_active_page(browser, user_name):
45
50
  if response.status_code != 200:
46
51
  return "failure"
47
52
  port = response.json()
48
- url = f"http://localhost:{port}/json"
49
- response = requests.get(url)
50
- if response.status_code != 200:
51
- return "failure"
52
- for t in response.json():
53
- if t.get("type") == "page":
54
- active_url = t.get("url")
55
- for page in browser.contexts[0].pages:
56
- if page.url == active_url:
57
- page.bring_to_front()
58
- return page
53
+
54
+ def get_json():
55
+ url = f"http://localhost:{port}/json"
56
+ response = requests.get(url)
57
+ if response.status_code != 200:
58
+ return "failure"
59
+ return response.json()
60
+
61
+ data = get_json()
62
+ if data:
63
+ return data[0].get("url")
64
+ return None
65
+
66
+
67
+ def get_active_page(browser, active_url):
68
+ """
69
+ 获取当前激活page对象
70
+ """
71
+ for page in browser.contexts[0].pages:
72
+ if page.url == active_url:
73
+ page.bring_to_front()
74
+ return page
59
75
 
60
76
 
61
77
  def upload_file(file_path, dest_file, user_name):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isrpa
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: isrpa package
5
5
  Home-page: https://github.com/yourusername/mypackage
6
6
  Author: ysq
@@ -5,8 +5,8 @@ isrpa/__init__.py,sha256=pG-YPVG0gJIJ6s4xcAz9S_CnUxpUcz33wl9eNUSgxGk,20
5
5
  isrpa/credentials.py,sha256=5paT4rxtZIUPqADmi1bLkoSKEYoosgS7rIjrJsgMNIs,3350
6
6
  isrpa/llm_chat.py,sha256=jTuK9wcm3X36V9lXuGuTCdNup_zi2NeG2GuYHzO7gm4,1541
7
7
  isrpa/message.py,sha256=N0s6hMaC5S-Pi4EhwcSp-ngfBTBQyW6ymU9sI9dUSeE,11329
8
- isrpa/utils.py,sha256=eUgdX1g6zt36zu05oXo2jwyT77n_rXn-gnyR8pwZLOE,3791
9
- isrpa-1.0.2.dist-info/METADATA,sha256=IPFbiotwSPElQviy5CpyuAeO88BEuZz95FmsAHLbkIo,511
10
- isrpa-1.0.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
11
- isrpa-1.0.2.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
12
- isrpa-1.0.2.dist-info/RECORD,,
8
+ isrpa/utils.py,sha256=y24xUNheQP89D0tityC7uDztJwCuItor4eJucHoqpFA,3996
9
+ isrpa-1.0.4.dist-info/METADATA,sha256=Eb2LwO4tVLsGeLQNaTpx8X99p6KuQhLGv9xXyMf5DNc,511
10
+ isrpa-1.0.4.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
11
+ isrpa-1.0.4.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
12
+ isrpa-1.0.4.dist-info/RECORD,,
File without changes