simplex 1.2.72__tar.gz → 1.2.76__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.72
3
+ Version: 1.2.76
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -22,7 +22,7 @@ class PostInstallCommand(install):
22
22
 
23
23
  setup(
24
24
  name="simplex",
25
- version="1.2.72",
25
+ version="1.2.76",
26
26
  packages=find_packages(),
27
27
  package_data={
28
28
  "simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
@@ -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(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.72
3
+ Version: 1.2.76
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
File without changes
File without changes
File without changes
File without changes
File without changes