simplex 1.2.71__tar.gz → 1.2.73__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
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: simplex
3
- Version: 1.2.71
3
+ Version: 1.2.73
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -19,16 +19,6 @@ Requires-Dist: python-dotenv
19
19
  Requires-Dist: click
20
20
  Provides-Extra: playwright
21
21
  Requires-Dist: rebrowser-playwright>=1.0.0; extra == "playwright"
22
- Dynamic: author
23
- Dynamic: author-email
24
- Dynamic: classifier
25
- Dynamic: description
26
- Dynamic: description-content-type
27
- Dynamic: home-page
28
- Dynamic: provides-extra
29
- Dynamic: requires-dist
30
- Dynamic: requires-python
31
- Dynamic: summary
32
22
 
33
23
  # Simplex AI Python SDK
34
24
 
@@ -22,7 +22,7 @@ class PostInstallCommand(install):
22
22
 
23
23
  setup(
24
24
  name="simplex",
25
- version="1.2.71",
25
+ version="1.2.73",
26
26
  packages=find_packages(),
27
27
  package_data={
28
28
  "simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
@@ -3,7 +3,7 @@ import os
3
3
  import json
4
4
  import warnings
5
5
  import requests
6
-
6
+ import time
7
7
  try:
8
8
  from rebrowser_playwright.sync_api import sync_playwright
9
9
  PLAYWRIGHT_AVAILABLE = True
@@ -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:
@@ -169,7 +171,7 @@ class Simplex:
169
171
 
170
172
  return self.session_id, livestream_url
171
173
 
172
- def goto(self, url: str):
174
+ def goto(self, url: str, override_fail_state: bool = False):
173
175
  if not self.session_id:
174
176
  raise ValueError(f"Must call create_session before calling action goto with url='{url}'")
175
177
 
@@ -178,7 +180,8 @@ class Simplex:
178
180
 
179
181
  data = {
180
182
  'url': url,
181
- 'session_id': self.session_id
183
+ 'session_id': self.session_id,
184
+ 'override_fail_state': override_fail_state
182
185
  }
183
186
 
184
187
  response = requests.post(
@@ -195,8 +198,33 @@ class Simplex:
195
198
  return
196
199
  else:
197
200
  raise ValueError(f"Failed to goto url: {response.json()['error']}")
201
+
202
+ def enqueue_actions(self, actions: list):
203
+ if not self.session_id:
204
+ raise ValueError(f"Must call create_session before calling action enqueue_actions with actions={actions}")
205
+
206
+ data = {
207
+ 'actions': json.dumps(actions),
208
+ 'session_id': self.session_id,
209
+ }
198
210
 
199
- def click(self, element_description: str):
211
+ response = requests.post(
212
+ f"{BASE_URL}/enqueue_actions",
213
+ headers={
214
+ 'x-api-key': self.api_key
215
+ },
216
+ data=data
217
+ )
218
+ if 'succeeded' not in response.json():
219
+ raise ValueError(f"It looks like the enqueue_actions action failed to return a response. Did you set your api_key when creating the Simplex class?")
220
+
221
+ if response.json()['succeeded']:
222
+ return
223
+ else:
224
+ raise ValueError(f"Failed to enqueue actions: {response.json()['error']}")
225
+
226
+
227
+ def click(self, element_description: str, override_fail_state: bool = False):
200
228
  if not element_description or not element_description.strip():
201
229
  raise ValueError("element_description cannot be empty")
202
230
  if not self.session_id:
@@ -204,7 +232,8 @@ class Simplex:
204
232
 
205
233
  data = {
206
234
  'element_description': element_description,
207
- 'session_id': self.session_id
235
+ 'session_id': self.session_id,
236
+ 'override_fail_state': override_fail_state
208
237
  }
209
238
 
210
239
  response = requests.post(
@@ -220,8 +249,36 @@ class Simplex:
220
249
  return response.json()["element_clicked"]
221
250
  else:
222
251
  raise ValueError(f"Failed to click element: {response.json()['error']}")
252
+
253
+ def get_dropdown_options(self, element_description: str, override_fail_state: bool = False):
254
+ if not element_description or not element_description.strip():
255
+ raise ValueError("element_description cannot be empty")
256
+ if not self.session_id:
257
+ raise ValueError(f"Must call create_session before calling action get_dropdown_options with element_description='{element_description}'")
258
+
259
+ data = {
260
+ 'element_description': element_description,
261
+ 'session_id': self.session_id,
262
+ 'override_fail_state': override_fail_state
263
+ }
264
+
265
+ response = requests.post(
266
+ f"{BASE_URL}/get_dropdown_options",
267
+ headers={
268
+ 'x-api-key': self.api_key
269
+ },
270
+ data=data
271
+ )
272
+
273
+ if 'succeeded' not in response.json():
274
+ 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?")
275
+ if response.json()['succeeded']:
276
+ return response.json()['dropdown_options']
277
+ else:
278
+ raise ValueError(f"Failed to get dropdown options: {response.json()['error']}")
279
+
223
280
 
224
- def select_dropdown_option(self, element_description: str):
281
+ def select_dropdown_option(self, element_description: str, override_fail_state: bool = False):
225
282
  if not element_description or not element_description.strip():
226
283
  raise ValueError("element_description cannot be empty")
227
284
  if not self.session_id:
@@ -229,7 +286,8 @@ class Simplex:
229
286
 
230
287
  data = {
231
288
  'element_description': element_description,
232
- 'session_id': self.session_id
289
+ 'session_id': self.session_id,
290
+ 'override_fail_state': override_fail_state
233
291
  }
234
292
 
235
293
  response = requests.post(
@@ -247,7 +305,7 @@ class Simplex:
247
305
  else:
248
306
  raise ValueError(f"Failed to select dropdown option: {response.json()['error']}")
249
307
 
250
- def scroll_to_element(self, element_description: str):
308
+ def scroll_to_element(self, element_description: str, override_fail_state: bool = False):
251
309
  if not element_description or not element_description.strip():
252
310
  raise ValueError("element_description cannot be empty")
253
311
  if not self.session_id:
@@ -255,7 +313,8 @@ class Simplex:
255
313
 
256
314
  data = {
257
315
  'element_description': element_description,
258
- 'session_id': self.session_id
316
+ 'session_id': self.session_id,
317
+ 'override_fail_state': override_fail_state
259
318
  }
260
319
 
261
320
  response = requests.post(
@@ -273,7 +332,7 @@ class Simplex:
273
332
  else:
274
333
  raise ValueError(f"Failed to scroll element into view: {response.json()['error']}")
275
334
 
276
- def hover(self, element_description: str):
335
+ def hover(self, element_description: str, override_fail_state: bool = False):
277
336
  if not element_description or not element_description.strip():
278
337
  raise ValueError("element_description cannot be empty")
279
338
  if not self.session_id:
@@ -281,7 +340,8 @@ class Simplex:
281
340
 
282
341
  data = {
283
342
  'element_description': element_description,
284
- 'session_id': self.session_id
343
+ 'session_id': self.session_id,
344
+ 'override_fail_state': override_fail_state
285
345
  }
286
346
 
287
347
  response = requests.post(
@@ -299,7 +359,7 @@ class Simplex:
299
359
  else:
300
360
  raise ValueError(f"Failed to hover: {response.json()['error']}")
301
361
 
302
- def type(self, text: str):
362
+ def type(self, text: str, override_fail_state: bool = False):
303
363
  if not text or not text.strip():
304
364
  raise ValueError("text cannot be empty")
305
365
  if not self.session_id:
@@ -307,7 +367,8 @@ class Simplex:
307
367
 
308
368
  data = {
309
369
  'text': text,
310
- 'session_id': self.session_id
370
+ 'session_id': self.session_id,
371
+ 'override_fail_state': override_fail_state
311
372
  }
312
373
 
313
374
  response = requests.post(
@@ -322,12 +383,13 @@ class Simplex:
322
383
  else:
323
384
  raise ValueError(f"Failed to type text: {response.json()['error']}")
324
385
 
325
- def reload(self):
386
+ def reload(self, override_fail_state: bool = False):
326
387
  if not self.session_id:
327
388
  raise ValueError("Must call create_session before calling action reload")
328
389
 
329
390
  data = {
330
- 'session_id': self.session_id
391
+ 'session_id': self.session_id,
392
+ 'override_fail_state': override_fail_state
331
393
  }
332
394
 
333
395
  response = requests.post(
@@ -344,12 +406,13 @@ class Simplex:
344
406
  else:
345
407
  raise ValueError(f"Failed to reload: {response.json()['error']}")
346
408
 
347
- def press_enter(self):
409
+ def press_enter(self, override_fail_state: bool = False):
348
410
  if not self.session_id:
349
411
  raise ValueError("Must call create_session before calling action press_enter")
350
412
 
351
413
  data = {
352
- 'session_id': self.session_id
414
+ 'session_id': self.session_id,
415
+ 'override_fail_state': override_fail_state
353
416
  }
354
417
 
355
418
  response = requests.post(
@@ -366,12 +429,13 @@ class Simplex:
366
429
  else:
367
430
  raise ValueError(f"Failed to press enter: {response.json()['error']}")
368
431
 
369
- def press_tab(self):
432
+ def press_tab(self, override_fail_state: bool = False):
370
433
  if not self.session_id:
371
434
  raise ValueError("Must call create_session before calling action press_tab")
372
435
 
373
436
  data = {
374
- 'session_id': self.session_id
437
+ 'session_id': self.session_id,
438
+ 'override_fail_state': override_fail_state
375
439
  }
376
440
 
377
441
  response = requests.post(
@@ -388,12 +452,13 @@ class Simplex:
388
452
  else:
389
453
  raise ValueError(f"Failed to press tab: {response.json()['error']}")
390
454
 
391
- def delete_text(self):
455
+ def delete_text(self, override_fail_state: bool = False):
392
456
  if not self.session_id:
393
457
  raise ValueError("Must call create_session before calling action delete_text")
394
458
 
395
459
  data = {
396
- 'session_id': self.session_id
460
+ 'session_id': self.session_id,
461
+ 'override_fail_state': override_fail_state
397
462
  }
398
463
 
399
464
  response = requests.post(
@@ -410,12 +475,13 @@ class Simplex:
410
475
  else:
411
476
  raise ValueError(f"Failed to delete text: {response.json()['error']}")
412
477
 
413
- def bot_tests(self):
478
+ def bot_tests(self, override_fail_state: bool = False):
414
479
  if not self.session_id:
415
480
  raise ValueError("Must call create_session before calling action bot_tests")
416
481
 
417
482
  data = {
418
- 'session_id': self.session_id
483
+ 'session_id': self.session_id,
484
+ 'override_fail_state': override_fail_state
419
485
  }
420
486
 
421
487
  response = requests.post(
@@ -432,7 +498,7 @@ class Simplex:
432
498
  else:
433
499
  raise ValueError(f"Failed to run bot tests: {response.json()['error']}")
434
500
 
435
- def extract_text(self, element_description: str):
501
+ def extract_text(self, element_description: str, override_fail_state: bool = False):
436
502
  if not element_description or not element_description.strip():
437
503
  raise ValueError("element_description cannot be empty")
438
504
  if not self.session_id:
@@ -440,7 +506,8 @@ class Simplex:
440
506
 
441
507
  data = {
442
508
  'element_description': element_description,
443
- 'session_id': self.session_id
509
+ 'session_id': self.session_id,
510
+ 'override_fail_state': override_fail_state
444
511
  }
445
512
 
446
513
  response = requests.post(
@@ -458,13 +525,14 @@ class Simplex:
458
525
  else:
459
526
  raise ValueError(f"Failed to extract text: {response_json['error']}")
460
527
 
461
- def scroll(self, pixels: float):
528
+ def scroll(self, pixels: float, override_fail_state: bool = False):
462
529
  if not self.session_id:
463
530
  raise ValueError(f"Must call create_session before calling action scroll with pixels={pixels}")
464
531
 
465
532
  data = {
466
533
  'pixels': pixels,
467
- 'session_id': self.session_id
534
+ 'session_id': self.session_id,
535
+ 'override_fail_state': override_fail_state
468
536
  }
469
537
 
470
538
  response = requests.post(
@@ -481,15 +549,15 @@ class Simplex:
481
549
  else:
482
550
  raise ValueError(f"Failed to scroll: {response.json()['error']}")
483
551
 
484
- def wait(self, milliseconds: int):
552
+ def wait(self, milliseconds: int, override_fail_state: bool = False):
485
553
  if not self.session_id:
486
554
  raise ValueError(f"Must call create_session before calling action wait with milliseconds={milliseconds}")
487
555
 
488
556
  data = {
489
557
  'milliseconds': milliseconds,
490
- 'session_id': self.session_id
558
+ 'session_id': self.session_id,
559
+ 'override_fail_state': override_fail_state
491
560
  }
492
-
493
561
  response = requests.post(
494
562
  f"{BASE_URL}/wait",
495
563
  headers={
@@ -503,7 +571,7 @@ class Simplex:
503
571
  return
504
572
  else:
505
573
  raise ValueError(f"Failed to wait: {response.json()['error']}")
506
-
574
+
507
575
  def create_login_session(self, url: str, save_directory: Optional[str] = None):
508
576
  if not PLAYWRIGHT_AVAILABLE:
509
577
  raise ImportError("This feature requires playwright. Install simplex[playwright] to use it.")
@@ -661,11 +729,12 @@ class Simplex:
661
729
  else:
662
730
  raise ValueError(f"Failed to restore login session: {response.json()['error']}")
663
731
 
664
- def click_and_upload(self, element_description: str, file_path_or_callable: Union[str, callable]):
732
+ def click_and_upload(self, element_description: str, file_path_or_callable: Union[str, callable], override_fail_state: bool = False):
665
733
  """
666
734
  Args:
667
735
  element_description: Description of the element to click and upload to
668
736
  file_path_or_callable: Either a path to the file to be uploaded or a callable that returns a file-like object in 'rb' mode
737
+ override_fail_state: Boolean to override fail state, default is False
669
738
  """
670
739
  if not element_description or not element_description.strip():
671
740
  raise ValueError("element_description cannot be empty")
@@ -687,7 +756,8 @@ class Simplex:
687
756
  raise ValueError("You must provide either a valid file path or a callable that returns a file-like object.")
688
757
  data = {
689
758
  'element_description': element_description,
690
- 'session_id': self.session_id
759
+ 'session_id': self.session_id,
760
+ 'override_fail_state': override_fail_state
691
761
  }
692
762
 
693
763
  response = requests.post(
@@ -705,18 +775,18 @@ class Simplex:
705
775
  else:
706
776
  raise ValueError(f"Failed to click and upload: {response.json()['error']}")
707
777
 
708
- def click_and_download(self, element_description: str):
778
+ def click_and_download(self, element_description: str, override_fail_state: bool = False):
709
779
  if not element_description or not element_description.strip():
710
780
  raise ValueError("element_description cannot be empty")
711
781
  if not self.session_id:
712
782
  raise ValueError(f"Must call create_session before calling action click_and_download with element_description='{element_description}'")
713
783
 
714
784
  data = {
715
- 'element_description': element_description
785
+ 'element_description': element_description,
786
+ 'session_id': self.session_id,
787
+ 'override_fail_state': override_fail_state
716
788
  }
717
789
 
718
- data['session_id'] = self.session_id
719
-
720
790
  response = requests.post(
721
791
  f"{BASE_URL}/click_and_download",
722
792
  headers={
@@ -753,7 +823,7 @@ class Simplex:
753
823
 
754
824
  return filename, response.content
755
825
 
756
- def exists(self, element_description: str):
826
+ def exists(self, element_description: str, override_fail_state: bool = False):
757
827
  if not element_description or not element_description.strip():
758
828
  raise ValueError("element_description cannot be empty")
759
829
  if not self.session_id:
@@ -761,7 +831,8 @@ class Simplex:
761
831
 
762
832
  data = {
763
833
  'element_description': element_description,
764
- 'session_id': self.session_id
834
+ 'session_id': self.session_id,
835
+ 'override_fail_state': override_fail_state
765
836
  }
766
837
 
767
838
  response = requests.post(
@@ -780,9 +851,10 @@ class Simplex:
780
851
  else:
781
852
  raise ValueError(f"Failed to check if element exists: {response_json['error']}")
782
853
 
783
- def capture_login_session(self):
854
+ def capture_login_session(self, override_fail_state: bool = False):
784
855
  data = {
785
- 'session_id': self.session_id
856
+ 'session_id': self.session_id,
857
+ 'override_fail_state': override_fail_state
786
858
  }
787
859
  response = requests.post(
788
860
  f"{BASE_URL}/capture_login_session",
@@ -803,9 +875,10 @@ class Simplex:
803
875
  raise ValueError(f"Failed to capture login session: {response_json['error']}")
804
876
 
805
877
 
806
- def get_page_url(self):
878
+ def get_page_url(self, override_fail_state: bool = False):
807
879
  data = {
808
- 'session_id': self.session_id
880
+ 'session_id': self.session_id,
881
+ 'override_fail_state': override_fail_state
809
882
  }
810
883
 
811
884
  response = requests.post(
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: simplex
3
- Version: 1.2.71
3
+ Version: 1.2.73
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -19,16 +19,6 @@ Requires-Dist: python-dotenv
19
19
  Requires-Dist: click
20
20
  Provides-Extra: playwright
21
21
  Requires-Dist: rebrowser-playwright>=1.0.0; extra == "playwright"
22
- Dynamic: author
23
- Dynamic: author-email
24
- Dynamic: classifier
25
- Dynamic: description
26
- Dynamic: description-content-type
27
- Dynamic: home-page
28
- Dynamic: provides-extra
29
- Dynamic: requires-dist
30
- Dynamic: requires-python
31
- Dynamic: summary
32
22
 
33
23
  # Simplex AI Python SDK
34
24
 
File without changes
File without changes
File without changes
File without changes
File without changes