simplex 1.2.64__tar.gz → 1.2.65__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.
- {simplex-1.2.64 → simplex-1.2.65}/PKG-INFO +12 -2
- {simplex-1.2.64 → simplex-1.2.65}/setup.py +1 -1
- {simplex-1.2.64 → simplex-1.2.65}/simplex/simplex.py +19 -67
- {simplex-1.2.64 → simplex-1.2.65}/simplex.egg-info/PKG-INFO +12 -2
- {simplex-1.2.64 → simplex-1.2.65}/LICENSE +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/README.md +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/setup.cfg +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex/__init__.py +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex/cli.py +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex/deploy/push.py +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex.egg-info/SOURCES.txt +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex.egg-info/requires.txt +0 -0
- {simplex-1.2.64 → simplex-1.2.65}/simplex.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.65
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -19,6 +19,16 @@ Requires-Dist: python-dotenv
|
|
|
19
19
|
Requires-Dist: click
|
|
20
20
|
Provides-Extra: playwright
|
|
21
21
|
Requires-Dist: 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
|
|
22
32
|
|
|
23
33
|
# Simplex AI Python SDK
|
|
24
34
|
|
|
@@ -4,9 +4,7 @@ from typing import Optional, Union
|
|
|
4
4
|
import os
|
|
5
5
|
import json
|
|
6
6
|
import warnings
|
|
7
|
-
|
|
8
|
-
import tempfile
|
|
9
|
-
# Try to import playwright, but don't fail if it's not available (lite version)
|
|
7
|
+
|
|
10
8
|
try:
|
|
11
9
|
from rebrowser_playwright.sync_api import sync_playwright
|
|
12
10
|
PLAYWRIGHT_AVAILABLE = True
|
|
@@ -27,53 +25,8 @@ except ImportError:
|
|
|
27
25
|
ImportWarning
|
|
28
26
|
)
|
|
29
27
|
|
|
30
|
-
BASE_URL = "https://api.
|
|
31
|
-
|
|
32
|
-
class Playwright:
|
|
33
|
-
def __init__(self, simplex_instance):
|
|
34
|
-
self.simplex = simplex_instance
|
|
35
|
-
|
|
36
|
-
def click(self, locator: str, locator_type: str, exact: Optional[bool] = False,
|
|
37
|
-
element_index: Optional[str] = None, nth_index: Optional[int] = None,
|
|
38
|
-
locator_options: Optional[dict] = None):
|
|
39
|
-
|
|
40
|
-
if element_index and element_index not in ["first", "last", "nth"]:
|
|
41
|
-
raise ValueError("element_index must be 'first', 'last', or 'nth'")
|
|
42
|
-
|
|
43
|
-
if element_index=="nth" and not nth_index:
|
|
44
|
-
raise ValueError("nth_index is required when element_index is 'nth'")
|
|
45
|
-
|
|
46
|
-
data = {
|
|
47
|
-
'session_id': self.simplex.session_id,
|
|
48
|
-
'locator': locator,
|
|
49
|
-
'locator_type': locator_type,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if element_index:
|
|
53
|
-
data['element_index'] = element_index
|
|
54
|
-
data['nth_index'] = nth_index
|
|
55
|
-
|
|
56
|
-
if exact:
|
|
57
|
-
data['exact'] = exact
|
|
58
|
-
|
|
59
|
-
if locator_options:
|
|
60
|
-
data['locator_options'] = json.dumps(locator_options)
|
|
61
|
-
|
|
62
|
-
response = requests.post(
|
|
63
|
-
f"{BASE_URL}/playwright/click",
|
|
64
|
-
headers={
|
|
65
|
-
'x-api-key': self.simplex.api_key
|
|
66
|
-
},
|
|
67
|
-
data=data
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
if 'succeeded' not in response.json():
|
|
71
|
-
raise ValueError(f"It looks like the click action with playwright failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
72
|
-
|
|
73
|
-
if "succeeded" in response.json():
|
|
74
|
-
return
|
|
75
|
-
else:
|
|
76
|
-
raise ValueError(f"Failed to click element: {response.json()['error']}")
|
|
28
|
+
BASE_URL = "https://simplex-dev--api-server-and-container-service-fastapi-app.modal.run"
|
|
29
|
+
# BASE_URL = "https://api.simplex.sh"
|
|
77
30
|
|
|
78
31
|
class Simplex:
|
|
79
32
|
def __init__(self, api_key: str):
|
|
@@ -81,11 +34,9 @@ class Simplex:
|
|
|
81
34
|
self.session_id = None
|
|
82
35
|
atexit.register(self.close_session)
|
|
83
36
|
if PLAYWRIGHT_AVAILABLE:
|
|
84
|
-
self.playwright = Playwright(self)
|
|
85
37
|
self.pw_browser = None
|
|
86
38
|
self.pw = None
|
|
87
39
|
else:
|
|
88
|
-
self.playwright = None
|
|
89
40
|
self.pw_browser = None
|
|
90
41
|
self.pw = None
|
|
91
42
|
|
|
@@ -114,13 +65,12 @@ class Simplex:
|
|
|
114
65
|
self.session_id = None
|
|
115
66
|
if 'succeeded' not in response.json():
|
|
116
67
|
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?")
|
|
117
|
-
if
|
|
68
|
+
if response.json()['succeeded']:
|
|
118
69
|
return
|
|
119
70
|
else:
|
|
120
71
|
raise ValueError(f"Failed to close session: {response.json()['error']}")
|
|
121
72
|
|
|
122
73
|
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, workflow_name: Optional[str] = None, session_data: Optional[dict | str] = None):
|
|
123
|
-
print("CREATING SESSION")
|
|
124
74
|
if self.session_id:
|
|
125
75
|
raise ValueError("A session is already active. Please close the current session before creating a new one.")
|
|
126
76
|
|
|
@@ -201,7 +151,7 @@ class Simplex:
|
|
|
201
151
|
if 'succeeded' not in response.json():
|
|
202
152
|
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?")
|
|
203
153
|
|
|
204
|
-
if
|
|
154
|
+
if response.json()['succeeded']:
|
|
205
155
|
return
|
|
206
156
|
else:
|
|
207
157
|
raise ValueError(f"Failed to goto url: {response.json()['error']}")
|
|
@@ -312,7 +262,7 @@ class Simplex:
|
|
|
312
262
|
},
|
|
313
263
|
data=data
|
|
314
264
|
)
|
|
315
|
-
if
|
|
265
|
+
if response.json()['succeeded']:
|
|
316
266
|
return
|
|
317
267
|
else:
|
|
318
268
|
raise ValueError(f"Failed to type text: {response.json()['error']}")
|
|
@@ -338,7 +288,7 @@ class Simplex:
|
|
|
338
288
|
)
|
|
339
289
|
if 'succeeded' not in response.json():
|
|
340
290
|
raise ValueError(f"It looks like the reload action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
341
|
-
if
|
|
291
|
+
if response.json()['succeeded']:
|
|
342
292
|
return
|
|
343
293
|
else:
|
|
344
294
|
raise ValueError(f"Failed to reload: {response.json()['error']}")
|
|
@@ -363,7 +313,7 @@ class Simplex:
|
|
|
363
313
|
)
|
|
364
314
|
if 'succeeded' not in response.json():
|
|
365
315
|
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?")
|
|
366
|
-
if
|
|
316
|
+
if response.json()['succeeded']:
|
|
367
317
|
return
|
|
368
318
|
else:
|
|
369
319
|
raise ValueError(f"Failed to press enter: {response.json()['error']}")
|
|
@@ -388,7 +338,7 @@ class Simplex:
|
|
|
388
338
|
)
|
|
389
339
|
if 'succeeded' not in response.json():
|
|
390
340
|
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?")
|
|
391
|
-
if
|
|
341
|
+
if response.json()['succeeded']:
|
|
392
342
|
return
|
|
393
343
|
else:
|
|
394
344
|
raise ValueError(f"Failed to press tab: {response.json()['error']}")
|
|
@@ -413,7 +363,7 @@ class Simplex:
|
|
|
413
363
|
)
|
|
414
364
|
if 'succeeded' not in response.json():
|
|
415
365
|
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?")
|
|
416
|
-
if
|
|
366
|
+
if response.json()['succeeded']:
|
|
417
367
|
return
|
|
418
368
|
else:
|
|
419
369
|
raise ValueError(f"Failed to delete text: {response.json()['error']}")
|
|
@@ -440,7 +390,7 @@ class Simplex:
|
|
|
440
390
|
)
|
|
441
391
|
if 'succeeded' not in response.json():
|
|
442
392
|
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?")
|
|
443
|
-
if
|
|
393
|
+
if response.json()['succeeded']:
|
|
444
394
|
return response.json()["bbox"]
|
|
445
395
|
else:
|
|
446
396
|
raise ValueError(f"Failed to extract bbox: {response.json()['error']}")
|
|
@@ -495,7 +445,7 @@ class Simplex:
|
|
|
495
445
|
)
|
|
496
446
|
if 'succeeded' not in response.json():
|
|
497
447
|
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?")
|
|
498
|
-
if
|
|
448
|
+
if response.json()['succeeded']:
|
|
499
449
|
return response.json()["image"]
|
|
500
450
|
else:
|
|
501
451
|
raise ValueError(f"Failed to extract image: {response.json()['error']}")
|
|
@@ -520,7 +470,7 @@ class Simplex:
|
|
|
520
470
|
)
|
|
521
471
|
if 'succeeded' not in response.json():
|
|
522
472
|
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?")
|
|
523
|
-
if
|
|
473
|
+
if response.json()['succeeded']:
|
|
524
474
|
return
|
|
525
475
|
else:
|
|
526
476
|
raise ValueError(f"Failed to scroll: {response.json()['error']}")
|
|
@@ -545,7 +495,7 @@ class Simplex:
|
|
|
545
495
|
)
|
|
546
496
|
if 'succeeded' not in response.json():
|
|
547
497
|
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?")
|
|
548
|
-
if
|
|
498
|
+
if response.json()['succeeded']:
|
|
549
499
|
return
|
|
550
500
|
else:
|
|
551
501
|
raise ValueError(f"Failed to wait: {response.json()['error']}")
|
|
@@ -601,6 +551,7 @@ class Simplex:
|
|
|
601
551
|
</body>
|
|
602
552
|
</html>
|
|
603
553
|
"""
|
|
554
|
+
import tempfile
|
|
604
555
|
# Write to a temporary file
|
|
605
556
|
with tempfile.NamedTemporaryFile(delete=False, suffix='.html', mode='w') as f:
|
|
606
557
|
f.write(html_content)
|
|
@@ -707,7 +658,7 @@ class Simplex:
|
|
|
707
658
|
)
|
|
708
659
|
if 'succeeded' not in response.json():
|
|
709
660
|
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?")
|
|
710
|
-
if
|
|
661
|
+
if response.json()['succeeded']:
|
|
711
662
|
return
|
|
712
663
|
else:
|
|
713
664
|
raise ValueError(f"Failed to restore login session: {response.json()['error']}")
|
|
@@ -751,7 +702,7 @@ class Simplex:
|
|
|
751
702
|
)
|
|
752
703
|
if 'succeeded' not in response.json():
|
|
753
704
|
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?")
|
|
754
|
-
if
|
|
705
|
+
if response.json()['succeeded']:
|
|
755
706
|
return
|
|
756
707
|
else:
|
|
757
708
|
raise ValueError(f"Failed to click and upload: {response.json()['error']}")
|
|
@@ -822,7 +773,8 @@ class Simplex:
|
|
|
822
773
|
if 'succeeded' not in response.json():
|
|
823
774
|
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?")
|
|
824
775
|
response_json = response.json()
|
|
825
|
-
|
|
776
|
+
|
|
777
|
+
if response_json['succeeded']:
|
|
826
778
|
return response_json['exists'], response_json['reasoning']
|
|
827
779
|
else:
|
|
828
780
|
raise ValueError(f"Failed to check if element exists: {response_json['error']}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.65
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -19,6 +19,16 @@ Requires-Dist: python-dotenv
|
|
|
19
19
|
Requires-Dist: click
|
|
20
20
|
Provides-Extra: playwright
|
|
21
21
|
Requires-Dist: 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
|
|
22
32
|
|
|
23
33
|
# Simplex AI Python SDK
|
|
24
34
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|