isrpa 1.0.9__py3-none-any.whl → 1.1.1__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
@@ -24,13 +24,10 @@ def getPath(user_name):
|
|
24
24
|
:return:
|
25
25
|
"""
|
26
26
|
|
27
|
-
# address = os.environ.get("address", "192.168.12.249")
|
28
|
-
|
29
27
|
url = f"{address}/client/getPath"
|
30
28
|
headers = {
|
31
|
-
'Content-Type': 'application/json',
|
29
|
+
'Content-Type': 'application/json',
|
32
30
|
}
|
33
|
-
# 请求体的数据
|
34
31
|
data = {
|
35
32
|
'user_name': user_name
|
36
33
|
}
|
@@ -64,7 +61,7 @@ def get_ssh_path(user_name):
|
|
64
61
|
|
65
62
|
def get_ws_url():
|
66
63
|
url = f"http://localhost:{port}/json/version"
|
67
|
-
response = requests.get(url)
|
64
|
+
response = requests.get(url, headers={"Connection": "close"}, stream=True)
|
68
65
|
if response.status_code != 200:
|
69
66
|
return "failure"
|
70
67
|
return response.json().get('webSocketDebuggerUrl')
|
@@ -73,6 +70,41 @@ def get_ssh_path(user_name):
|
|
73
70
|
return ws_url
|
74
71
|
|
75
72
|
|
73
|
+
def get_url(user_name):
|
74
|
+
"""
|
75
|
+
获取当前激活page对象
|
76
|
+
"""
|
77
|
+
url = f"{address}/client/getPath"
|
78
|
+
headers = {'Content-Type': 'application/json'}
|
79
|
+
data = {'user_name': user_name}
|
80
|
+
response = requests.post(url, headers=headers, json=data)
|
81
|
+
if response.status_code != 200:
|
82
|
+
return "failure"
|
83
|
+
data = response.json()
|
84
|
+
port = data.get('port')
|
85
|
+
|
86
|
+
def get_json():
|
87
|
+
url = f"http://localhost:{port}/json"
|
88
|
+
response = requests.get(url, headers={"Connection": "close"}, stream=True)
|
89
|
+
if response.status_code != 200:
|
90
|
+
return "failure"
|
91
|
+
return response.json()
|
92
|
+
|
93
|
+
pages = get_json()
|
94
|
+
if pages:
|
95
|
+
for page in pages:
|
96
|
+
if (
|
97
|
+
page.get("url").startswith("chrome-extension://") or
|
98
|
+
page.get("url").startswith("chrome-untrusted://") or
|
99
|
+
page.get("title") == "MagicalAutomator-sidePanel"
|
100
|
+
):
|
101
|
+
continue
|
102
|
+
else:
|
103
|
+
if page.get("url") == "chrome://newtab/":
|
104
|
+
return "chrome://new-tab-page/"
|
105
|
+
return page.get("url")
|
106
|
+
return None
|
107
|
+
|
76
108
|
def get_active_url(user_name):
|
77
109
|
"""
|
78
110
|
获取当前激活page对象
|
@@ -88,7 +120,7 @@ def get_active_url(user_name):
|
|
88
120
|
|
89
121
|
def get_json():
|
90
122
|
url = f"http://localhost:{port}/json"
|
91
|
-
response = requests.get(url)
|
123
|
+
response = requests.get(url, headers={"Connection": "close"}, stream=True)
|
92
124
|
if response.status_code != 200:
|
93
125
|
return "failure"
|
94
126
|
return response.json()
|
@@ -102,9 +134,6 @@ def get_active_url(user_name):
|
|
102
134
|
page.get("title") == "MagicalAutomator-sidePanel"
|
103
135
|
):
|
104
136
|
continue
|
105
|
-
# else:
|
106
|
-
# if page.get("url") == "chrome://newtab/":
|
107
|
-
# return "chrome://new-tab-page/"
|
108
137
|
return page.get("id")
|
109
138
|
return None
|
110
139
|
|
@@ -134,12 +163,10 @@ def upload_file(file_path, dest_file, user_name):
|
|
134
163
|
:return:
|
135
164
|
"""
|
136
165
|
|
137
|
-
# address = os.environ.get("address", "192.168.12.249")
|
138
166
|
url = f"{address}/client/noticeUpload"
|
139
167
|
headers = {
|
140
|
-
'Content-Type': 'application/json',
|
168
|
+
'Content-Type': 'application/json',
|
141
169
|
}
|
142
|
-
# 请求体的数据
|
143
170
|
data = {
|
144
171
|
'file_path': file_path,
|
145
172
|
'dest_file': dest_file,
|
@@ -159,10 +186,9 @@ def vCode(image: str, code_type, apiKey, secretKey):
|
|
159
186
|
"""
|
160
187
|
url = "https://ai.i-search.com.cn/ocr/v2/vCode"
|
161
188
|
headers = {
|
162
|
-
'Content-Type': 'application/json',
|
189
|
+
'Content-Type': 'application/json',
|
163
190
|
}
|
164
191
|
|
165
|
-
# 请求体的数据
|
166
192
|
data = {
|
167
193
|
'image': image,
|
168
194
|
'code_type': code_type,
|
@@ -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.
|
10
|
-
isrpa-1.
|
11
|
-
isrpa-1.
|
12
|
-
isrpa-1.
|
8
|
+
isrpa/utils.py,sha256=opHSj0unbVPaeQid2_Lgyub1YbEJFGtUzZF0_JnvcVE,6516
|
9
|
+
isrpa-1.1.1.dist-info/METADATA,sha256=pOEYQHr7xRAavJC2PcgRsBPsPDmC918dvO-yFuAJdNo,511
|
10
|
+
isrpa-1.1.1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
11
|
+
isrpa-1.1.1.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
|
12
|
+
isrpa-1.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|