isrpa 1.0.8__py3-none-any.whl → 1.1.0__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
@@ -73,7 +73,7 @@ def get_ssh_path(user_name):
|
|
73
73
|
return ws_url
|
74
74
|
|
75
75
|
|
76
|
-
def
|
76
|
+
def get_url(user_name):
|
77
77
|
"""
|
78
78
|
获取当前激活page对象
|
79
79
|
"""
|
@@ -108,13 +108,50 @@ def get_active_url(user_name):
|
|
108
108
|
return page.get("url")
|
109
109
|
return None
|
110
110
|
|
111
|
+
def get_active_url(user_name):
|
112
|
+
"""
|
113
|
+
获取当前激活page对象
|
114
|
+
"""
|
115
|
+
url = f"{address}/client/getPath"
|
116
|
+
headers = {'Content-Type': 'application/json'}
|
117
|
+
data = {'user_name': user_name}
|
118
|
+
response = requests.post(url, headers=headers, json=data)
|
119
|
+
if response.status_code != 200:
|
120
|
+
return "failure"
|
121
|
+
data = response.json()
|
122
|
+
port = data.get('port')
|
123
|
+
|
124
|
+
def get_json():
|
125
|
+
url = f"http://localhost:{port}/json"
|
126
|
+
response = requests.get(url)
|
127
|
+
if response.status_code != 200:
|
128
|
+
return "failure"
|
129
|
+
return response.json()
|
130
|
+
|
131
|
+
pages = get_json()
|
132
|
+
if pages:
|
133
|
+
for page in pages:
|
134
|
+
if (
|
135
|
+
page.get("url").startswith("chrome-extension://") or
|
136
|
+
page.get("url").startswith("chrome-untrusted://") or
|
137
|
+
page.get("title") == "MagicalAutomator-sidePanel"
|
138
|
+
):
|
139
|
+
continue
|
140
|
+
# else:
|
141
|
+
# if page.get("url") == "chrome://newtab/":
|
142
|
+
# return "chrome://new-tab-page/"
|
143
|
+
return page.get("id")
|
144
|
+
return None
|
145
|
+
|
111
146
|
|
112
|
-
def get_active_page(browser,
|
147
|
+
def get_active_page(browser, active_page_id):
|
113
148
|
"""
|
114
149
|
获取当前激活page对象
|
115
150
|
"""
|
116
151
|
for page in browser.contexts[0].pages:
|
117
|
-
|
152
|
+
client = page.context.new_cdp_session(page)
|
153
|
+
target_info = client.send("Target.getTargetInfo")
|
154
|
+
if target_info.get('targetInfo').get('targetId') == active_page_id:
|
118
155
|
page.bring_to_front()
|
119
156
|
return page
|
120
157
|
|
@@ -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=
|
9
|
-
isrpa-1.0.
|
10
|
-
isrpa-1.0.
|
11
|
-
isrpa-1.0.
|
12
|
-
isrpa-1.0.
|
8
|
+
isrpa/utils.py,sha256=tN270H9E_NK3bc-FnUX0fONjvb52yskBBMD0pUMf-ug,6819
|
9
|
+
isrpa-1.1.0.dist-info/METADATA,sha256=jeFGuZLYUJ42huP0r-gliPCx6yvoMhhbAnUKpypIQJ0,511
|
10
|
+
isrpa-1.1.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
11
|
+
isrpa-1.1.0.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
|
12
|
+
isrpa-1.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|