simplex 1.2.31__py3-none-any.whl → 1.2.33__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.
Potentially problematic release.
This version of simplex might be problematic. Click here for more details.
- simplex/simplex.py +55 -7
- {simplex-1.2.31.dist-info → simplex-1.2.33.dist-info}/METADATA +1 -1
- simplex-1.2.33.dist-info/RECORD +11 -0
- simplex-1.2.31.dist-info/RECORD +0 -11
- {simplex-1.2.31.dist-info → simplex-1.2.33.dist-info}/LICENSE +0 -0
- {simplex-1.2.31.dist-info → simplex-1.2.33.dist-info}/WHEEL +0 -0
- {simplex-1.2.31.dist-info → simplex-1.2.33.dist-info}/entry_points.txt +0 -0
- {simplex-1.2.31.dist-info → simplex-1.2.33.dist-info}/top_level.txt +0 -0
simplex/simplex.py
CHANGED
|
@@ -22,7 +22,8 @@ class Simplex:
|
|
|
22
22
|
data={'session_id': self.session_id}
|
|
23
23
|
)
|
|
24
24
|
self.session_id = None
|
|
25
|
-
|
|
25
|
+
if 'succeeded' not in response.json():
|
|
26
|
+
raise ValueError(f"It looks like the close_session action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
26
27
|
if response.json()["succeeded"]:
|
|
27
28
|
return
|
|
28
29
|
else:
|
|
@@ -36,6 +37,10 @@ class Simplex:
|
|
|
36
37
|
},
|
|
37
38
|
data={'proxies': proxies}
|
|
38
39
|
)
|
|
40
|
+
# Check for non-200 status code
|
|
41
|
+
if response.status_code != 200:
|
|
42
|
+
raise ValueError(f"Create session request failed with status code {response.status_code}: {response.text}")
|
|
43
|
+
|
|
39
44
|
response_json = response.json()
|
|
40
45
|
if 'session_id' not in response_json:
|
|
41
46
|
raise ValueError(f"It looks like the session wasn't created successfully. Did you set your api_key when creating the Simplex class?")
|
|
@@ -68,6 +73,9 @@ class Simplex:
|
|
|
68
73
|
},
|
|
69
74
|
data=data
|
|
70
75
|
)
|
|
76
|
+
if 'succeeded' not in response.json():
|
|
77
|
+
raise ValueError(f"It looks like the goto action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
78
|
+
|
|
71
79
|
if response.json()["succeeded"]:
|
|
72
80
|
return
|
|
73
81
|
else:
|
|
@@ -91,6 +99,8 @@ class Simplex:
|
|
|
91
99
|
},
|
|
92
100
|
data=data
|
|
93
101
|
)
|
|
102
|
+
if 'succeeded' not in response.json():
|
|
103
|
+
raise ValueError(f"It looks like the click action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
94
104
|
if response.json()["succeeded"]:
|
|
95
105
|
return response.json()["element_clicked"]
|
|
96
106
|
else:
|
|
@@ -137,6 +147,8 @@ class Simplex:
|
|
|
137
147
|
},
|
|
138
148
|
data=data
|
|
139
149
|
)
|
|
150
|
+
if 'succeeded' not in response.json():
|
|
151
|
+
raise ValueError(f"It looks like the press_enter action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
140
152
|
if response.json()["succeeded"]:
|
|
141
153
|
return
|
|
142
154
|
else:
|
|
@@ -160,6 +172,8 @@ class Simplex:
|
|
|
160
172
|
},
|
|
161
173
|
data=data
|
|
162
174
|
)
|
|
175
|
+
if 'succeeded' not in response.json():
|
|
176
|
+
raise ValueError(f"It looks like the press_tab action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
163
177
|
if response.json()["succeeded"]:
|
|
164
178
|
return
|
|
165
179
|
else:
|
|
@@ -183,6 +197,8 @@ class Simplex:
|
|
|
183
197
|
},
|
|
184
198
|
data=data
|
|
185
199
|
)
|
|
200
|
+
if 'succeeded' not in response.json():
|
|
201
|
+
raise ValueError(f"It looks like the delete_text action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
186
202
|
if response.json()["succeeded"]:
|
|
187
203
|
return
|
|
188
204
|
else:
|
|
@@ -206,6 +222,8 @@ class Simplex:
|
|
|
206
222
|
},
|
|
207
223
|
params=data
|
|
208
224
|
)
|
|
225
|
+
if 'succeeded' not in response.json():
|
|
226
|
+
raise ValueError(f"It looks like the extract_bbox action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
209
227
|
if response.json()["succeeded"]:
|
|
210
228
|
return response.json()["bbox"]
|
|
211
229
|
else:
|
|
@@ -229,6 +247,8 @@ class Simplex:
|
|
|
229
247
|
},
|
|
230
248
|
params=data
|
|
231
249
|
)
|
|
250
|
+
if 'succeeded' not in response.json():
|
|
251
|
+
raise ValueError(f"It looks like the extract_text action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
232
252
|
if response.json()["succeeded"]:
|
|
233
253
|
return response.json()["text"]
|
|
234
254
|
else:
|
|
@@ -252,6 +272,8 @@ class Simplex:
|
|
|
252
272
|
},
|
|
253
273
|
params=data
|
|
254
274
|
)
|
|
275
|
+
if 'succeeded' not in response.json():
|
|
276
|
+
raise ValueError(f"It looks like the extract_image action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
255
277
|
if response.json()["succeeded"]:
|
|
256
278
|
return response.json()["image"]
|
|
257
279
|
else:
|
|
@@ -275,6 +297,8 @@ class Simplex:
|
|
|
275
297
|
},
|
|
276
298
|
data=data
|
|
277
299
|
)
|
|
300
|
+
if 'succeeded' not in response.json():
|
|
301
|
+
raise ValueError(f"It looks like the scroll action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
278
302
|
if response.json()["succeeded"]:
|
|
279
303
|
return
|
|
280
304
|
else:
|
|
@@ -298,6 +322,8 @@ class Simplex:
|
|
|
298
322
|
},
|
|
299
323
|
data=data
|
|
300
324
|
)
|
|
325
|
+
if 'succeeded' not in response.json():
|
|
326
|
+
raise ValueError(f"It looks like the wait action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
301
327
|
if response.json()["succeeded"]:
|
|
302
328
|
return
|
|
303
329
|
else:
|
|
@@ -311,20 +337,34 @@ class Simplex:
|
|
|
311
337
|
},
|
|
312
338
|
data={'url': url, 'proxies': proxies}
|
|
313
339
|
)
|
|
340
|
+
if 'succeeded' not in response.json():
|
|
341
|
+
raise ValueError(f"It looks like the create_login_session action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
314
342
|
if response.json()["succeeded"]:
|
|
315
343
|
return response.json()["login_session_url"]
|
|
316
344
|
else:
|
|
317
345
|
raise ValueError(f"Failed to create login session: {response.json()['error']}")
|
|
318
346
|
|
|
319
|
-
def restore_login_session(self,
|
|
320
|
-
|
|
347
|
+
def restore_login_session(self, session_data: str, cdp_url: str = None):
|
|
348
|
+
"""
|
|
349
|
+
Restore a login session from either a file path or a JSON string.
|
|
321
350
|
|
|
322
|
-
|
|
323
|
-
session_data
|
|
351
|
+
Args:
|
|
352
|
+
session_data: Either a file path to JSON file or a JSON string
|
|
353
|
+
cdp_url: Optional CDP URL for remote debugging
|
|
354
|
+
"""
|
|
355
|
+
try:
|
|
356
|
+
# Try to parse as JSON string first
|
|
357
|
+
session_data_dict = json.loads(session_data)
|
|
358
|
+
except json.JSONDecodeError:
|
|
359
|
+
# If parsing fails, treat as file path
|
|
360
|
+
try:
|
|
361
|
+
with open(session_data, 'r') as f:
|
|
362
|
+
session_data_dict = json.load(f)
|
|
363
|
+
except Exception as e:
|
|
364
|
+
raise ValueError(f"Failed to load session data. Input must be valid JSON string or path to JSON file. Error: {str(e)}")
|
|
324
365
|
|
|
325
|
-
# Serialize the data to JSON string
|
|
326
366
|
data = {
|
|
327
|
-
'session_data': json.dumps(
|
|
367
|
+
'session_data': json.dumps(session_data_dict)
|
|
328
368
|
}
|
|
329
369
|
if cdp_url:
|
|
330
370
|
data['cdp_url'] = cdp_url
|
|
@@ -338,6 +378,8 @@ class Simplex:
|
|
|
338
378
|
},
|
|
339
379
|
data=data
|
|
340
380
|
)
|
|
381
|
+
if 'succeeded' not in response.json():
|
|
382
|
+
raise ValueError(f"It looks like the restore_login_session action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
341
383
|
if response.json()["succeeded"]:
|
|
342
384
|
return
|
|
343
385
|
else:
|
|
@@ -365,6 +407,8 @@ class Simplex:
|
|
|
365
407
|
files=files,
|
|
366
408
|
data=data
|
|
367
409
|
)
|
|
410
|
+
if 'succeeded' not in response.json():
|
|
411
|
+
raise ValueError(f"It looks like the click_and_upload action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
368
412
|
if response.json()["succeeded"]:
|
|
369
413
|
return
|
|
370
414
|
else:
|
|
@@ -387,6 +431,8 @@ class Simplex:
|
|
|
387
431
|
},
|
|
388
432
|
data=data
|
|
389
433
|
)
|
|
434
|
+
if 'succeeded' not in response.json():
|
|
435
|
+
raise ValueError(f"It looks like the click_and_download action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
390
436
|
if response.json()["succeeded"]:
|
|
391
437
|
return response.json()["b64"], response.json()["filename"]
|
|
392
438
|
else:
|
|
@@ -410,6 +456,8 @@ class Simplex:
|
|
|
410
456
|
},
|
|
411
457
|
data=data
|
|
412
458
|
)
|
|
459
|
+
if 'succeeded' not in response.json():
|
|
460
|
+
raise ValueError(f"It looks like the exists action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
413
461
|
response_json = response.json()
|
|
414
462
|
if response_json['succeeded']:
|
|
415
463
|
return response_json['exists'], response_json['reasoning']
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
|
|
2
|
+
simplex/cli.py,sha256=FlZPWx014wpIy3TWYxhv8pANoPG9UWoq-ipkEIaiJAU,2389
|
|
3
|
+
simplex/simplex.py,sha256=jYmeXQx09FneIl9_XjLWJ0v_EvY6jqlwHCmMoJYPkTE,17653
|
|
4
|
+
simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
|
|
5
|
+
simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
|
|
6
|
+
simplex-1.2.33.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
7
|
+
simplex-1.2.33.dist-info/METADATA,sha256=EVVVPa7m5G4P9ZK2UCAQRCSa6iFtDNeyqV8qbJLYTnI,938
|
|
8
|
+
simplex-1.2.33.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
+
simplex-1.2.33.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
10
|
+
simplex-1.2.33.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
11
|
+
simplex-1.2.33.dist-info/RECORD,,
|
simplex-1.2.31.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
|
|
2
|
-
simplex/cli.py,sha256=FlZPWx014wpIy3TWYxhv8pANoPG9UWoq-ipkEIaiJAU,2389
|
|
3
|
-
simplex/simplex.py,sha256=rFISsAihefu1WbktzAPAy2GDTIKpGkLZPV7wriej3w4,13621
|
|
4
|
-
simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
|
|
5
|
-
simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
|
|
6
|
-
simplex-1.2.31.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
7
|
-
simplex-1.2.31.dist-info/METADATA,sha256=J-7fusHtfk2fHX25p7n8w5ol2edKIxoJkQOz7IqCDho,938
|
|
8
|
-
simplex-1.2.31.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
-
simplex-1.2.31.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
10
|
-
simplex-1.2.31.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
11
|
-
simplex-1.2.31.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|