simplex 1.2.72__py3-none-any.whl → 1.2.76__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 +129 -4
- {simplex-1.2.72.dist-info → simplex-1.2.76.dist-info}/METADATA +1 -1
- simplex-1.2.76.dist-info/RECORD +11 -0
- simplex-1.2.72.dist-info/RECORD +0 -11
- {simplex-1.2.72.dist-info → simplex-1.2.76.dist-info}/LICENSE +0 -0
- {simplex-1.2.72.dist-info → simplex-1.2.76.dist-info}/WHEEL +0 -0
- {simplex-1.2.72.dist-info → simplex-1.2.76.dist-info}/entry_points.txt +0 -0
- {simplex-1.2.72.dist-info → simplex-1.2.76.dist-info}/top_level.txt +0 -0
simplex/simplex.py
CHANGED
|
@@ -24,6 +24,8 @@ except ImportError:
|
|
|
24
24
|
ImportWarning
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
+
# BASE_URL = "https://simplex-dev-shreya--api-server-and-container-service-fas-bba69e.modal.run"
|
|
28
|
+
# BASE_URL = "https://simplex-dev--api-server-and-container-service-fastapi-app.modal.run"
|
|
27
29
|
BASE_URL = "https://api.simplex.sh"
|
|
28
30
|
|
|
29
31
|
class Playwright:
|
|
@@ -220,9 +222,48 @@ class Simplex:
|
|
|
220
222
|
return
|
|
221
223
|
else:
|
|
222
224
|
raise ValueError(f"Failed to enqueue actions: {response.json()['error']}")
|
|
225
|
+
|
|
226
|
+
def captcha_exists(self):
|
|
227
|
+
data = {
|
|
228
|
+
'session_id': self.session_id,
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
response = requests.post(
|
|
232
|
+
f"{BASE_URL}/captcha_exists",
|
|
233
|
+
headers={
|
|
234
|
+
'x-api-key': self.api_key
|
|
235
|
+
},
|
|
236
|
+
data=data
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
if 'succeeded' not in response.json():
|
|
240
|
+
raise ValueError(f"It looks like the captcha_exists action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
241
|
+
if response.json()['succeeded']:
|
|
242
|
+
return response.json()['captcha_detected']
|
|
243
|
+
else:
|
|
244
|
+
raise ValueError(f"Failed to check if captcha is present: {response.json()['error']}")
|
|
245
|
+
|
|
246
|
+
def wait_for_captcha(self):
|
|
247
|
+
data = {
|
|
248
|
+
'session_id': self.session_id,
|
|
249
|
+
}
|
|
223
250
|
|
|
251
|
+
response = requests.post(
|
|
252
|
+
f"{BASE_URL}/wait_for_captcha",
|
|
253
|
+
headers={
|
|
254
|
+
'x-api-key': self.api_key
|
|
255
|
+
},
|
|
256
|
+
data=data
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
if 'succeeded' not in response.json():
|
|
260
|
+
raise ValueError(f"It looks like the wait_for_captcha action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
261
|
+
if response.json()['succeeded']:
|
|
262
|
+
return response.json()['captcha_solved']
|
|
263
|
+
else:
|
|
264
|
+
raise ValueError(f"Failed to wait for captcha: {response.json()['error']}")
|
|
224
265
|
|
|
225
|
-
def click(self, element_description: str, override_fail_state: bool = False):
|
|
266
|
+
def click(self, element_description: str, dropdown_option: bool = False, override_fail_state: bool = False):
|
|
226
267
|
if not element_description or not element_description.strip():
|
|
227
268
|
raise ValueError("element_description cannot be empty")
|
|
228
269
|
if not self.session_id:
|
|
@@ -231,7 +272,8 @@ class Simplex:
|
|
|
231
272
|
data = {
|
|
232
273
|
'element_description': element_description,
|
|
233
274
|
'session_id': self.session_id,
|
|
234
|
-
'override_fail_state': override_fail_state
|
|
275
|
+
'override_fail_state': override_fail_state,
|
|
276
|
+
'dropdown_option': dropdown_option
|
|
235
277
|
}
|
|
236
278
|
|
|
237
279
|
response = requests.post(
|
|
@@ -247,6 +289,34 @@ class Simplex:
|
|
|
247
289
|
return response.json()["element_clicked"]
|
|
248
290
|
else:
|
|
249
291
|
raise ValueError(f"Failed to click element: {response.json()['error']}")
|
|
292
|
+
|
|
293
|
+
def get_dropdown_options(self, element_description: str, override_fail_state: bool = False):
|
|
294
|
+
if not element_description or not element_description.strip():
|
|
295
|
+
raise ValueError("element_description cannot be empty")
|
|
296
|
+
if not self.session_id:
|
|
297
|
+
raise ValueError(f"Must call create_session before calling action get_dropdown_options with element_description='{element_description}'")
|
|
298
|
+
|
|
299
|
+
data = {
|
|
300
|
+
'element_description': element_description,
|
|
301
|
+
'session_id': self.session_id,
|
|
302
|
+
'override_fail_state': override_fail_state
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
response = requests.post(
|
|
306
|
+
f"{BASE_URL}/get_dropdown_options",
|
|
307
|
+
headers={
|
|
308
|
+
'x-api-key': self.api_key
|
|
309
|
+
},
|
|
310
|
+
data=data
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
if 'succeeded' not in response.json():
|
|
314
|
+
raise ValueError(f"It looks like the get_dropdown_options action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
315
|
+
if response.json()['succeeded']:
|
|
316
|
+
return response.json()['dropdown_options']
|
|
317
|
+
else:
|
|
318
|
+
raise ValueError(f"Failed to get dropdown options: {response.json()['error']}")
|
|
319
|
+
|
|
250
320
|
|
|
251
321
|
def select_dropdown_option(self, element_description: str, override_fail_state: bool = False):
|
|
252
322
|
if not element_description or not element_description.strip():
|
|
@@ -542,6 +612,60 @@ class Simplex:
|
|
|
542
612
|
else:
|
|
543
613
|
raise ValueError(f"Failed to wait: {response.json()['error']}")
|
|
544
614
|
|
|
615
|
+
def set_dialog_settings(self, accept: bool = True):
|
|
616
|
+
if not self.session_id:
|
|
617
|
+
raise ValueError("Must call create_session before calling action set_dialog_settings")
|
|
618
|
+
|
|
619
|
+
data = {
|
|
620
|
+
'session_id': self.session_id,
|
|
621
|
+
'accept': accept
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
response = requests.post(
|
|
625
|
+
f"{BASE_URL}/set_dialog_settings",
|
|
626
|
+
headers={
|
|
627
|
+
'x-api-key': self.api_key
|
|
628
|
+
},
|
|
629
|
+
data=data
|
|
630
|
+
)
|
|
631
|
+
|
|
632
|
+
if 'succeeded' not in response.json():
|
|
633
|
+
raise ValueError(f"It looks like the set_dialog_settings action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
634
|
+
if response.json()['succeeded']:
|
|
635
|
+
return
|
|
636
|
+
else:
|
|
637
|
+
raise ValueError(f"Failed to set dialog settings: {response.json()['error']}")
|
|
638
|
+
|
|
639
|
+
def get_dialog_message(self):
|
|
640
|
+
if not self.session_id:
|
|
641
|
+
raise ValueError("Must call create_session before calling action get_dialog_message")
|
|
642
|
+
|
|
643
|
+
data = {
|
|
644
|
+
'session_id': self.session_id
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
response = requests.post(
|
|
648
|
+
f"{BASE_URL}/get_dialog_message",
|
|
649
|
+
headers={
|
|
650
|
+
'x-api-key': self.api_key
|
|
651
|
+
},
|
|
652
|
+
data=data
|
|
653
|
+
)
|
|
654
|
+
|
|
655
|
+
if 'succeeded' not in response.json():
|
|
656
|
+
raise ValueError(f"It looks like the get_dialog_message action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
657
|
+
|
|
658
|
+
res = response.json()
|
|
659
|
+
if res['succeeded']:
|
|
660
|
+
if 'message' in res:
|
|
661
|
+
return res['message']
|
|
662
|
+
else:
|
|
663
|
+
return None
|
|
664
|
+
else:
|
|
665
|
+
raise ValueError(f"Failed to get dialog message: {response.json()['error']}")
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
545
669
|
def create_login_session(self, url: str, save_directory: Optional[str] = None):
|
|
546
670
|
if not PLAYWRIGHT_AVAILABLE:
|
|
547
671
|
raise ImportError("This feature requires playwright. Install simplex[playwright] to use it.")
|
|
@@ -793,7 +917,7 @@ class Simplex:
|
|
|
793
917
|
|
|
794
918
|
return filename, response.content
|
|
795
919
|
|
|
796
|
-
def exists(self, element_description: str, override_fail_state: bool = False):
|
|
920
|
+
def exists(self, element_description: str, override_fail_state: bool = False, max_steps: Optional[int] = None):
|
|
797
921
|
if not element_description or not element_description.strip():
|
|
798
922
|
raise ValueError("element_description cannot be empty")
|
|
799
923
|
if not self.session_id:
|
|
@@ -802,7 +926,8 @@ class Simplex:
|
|
|
802
926
|
data = {
|
|
803
927
|
'element_description': element_description,
|
|
804
928
|
'session_id': self.session_id,
|
|
805
|
-
'override_fail_state': override_fail_state
|
|
929
|
+
'override_fail_state': override_fail_state,
|
|
930
|
+
'max_steps': max_steps
|
|
806
931
|
}
|
|
807
932
|
|
|
808
933
|
response = requests.post(
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
|
|
2
|
+
simplex/cli.py,sha256=0K_pzoVdF7vfTJPUONhFzzTvjZk2M7FZPpEONjZWJC8,2268
|
|
3
|
+
simplex/simplex.py,sha256=NsSGeR_bmqpl60aVvak0LoBJMyzySCEvstFXjS4vTS0,39767
|
|
4
|
+
simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
|
|
5
|
+
simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
|
|
6
|
+
simplex-1.2.76.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
7
|
+
simplex-1.2.76.dist-info/METADATA,sha256=I20rjBbj_P7lioJ4ijblp0j2V3BMJKVDuWl-P2ZfC3E,1055
|
|
8
|
+
simplex-1.2.76.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
+
simplex-1.2.76.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
10
|
+
simplex-1.2.76.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
11
|
+
simplex-1.2.76.dist-info/RECORD,,
|
simplex-1.2.72.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
|
|
2
|
-
simplex/cli.py,sha256=0K_pzoVdF7vfTJPUONhFzzTvjZk2M7FZPpEONjZWJC8,2268
|
|
3
|
-
simplex/simplex.py,sha256=zWJ4JSOF6aCWHeaBTrubrQ8Fxl7n8lyabyg5MAtuC88,34958
|
|
4
|
-
simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
|
|
5
|
-
simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
|
|
6
|
-
simplex-1.2.72.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
7
|
-
simplex-1.2.72.dist-info/METADATA,sha256=3Xs33FZ2JBm_SZ0rw_pZOOX2wGdaZ5ryCaCMACOYuBs,1055
|
|
8
|
-
simplex-1.2.72.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
-
simplex-1.2.72.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
10
|
-
simplex-1.2.72.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
11
|
-
simplex-1.2.72.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|