simplex 1.2.65__tar.gz → 1.2.70__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.65 → simplex-1.2.70}/PKG-INFO +2 -2
- {simplex-1.2.65 → simplex-1.2.70}/setup.py +6 -6
- {simplex-1.2.65 → simplex-1.2.70}/simplex/simplex.py +83 -4
- {simplex-1.2.65 → simplex-1.2.70}/simplex.egg-info/PKG-INFO +2 -2
- {simplex-1.2.65 → simplex-1.2.70}/simplex.egg-info/requires.txt +1 -1
- {simplex-1.2.65 → simplex-1.2.70}/LICENSE +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/README.md +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/setup.cfg +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex/__init__.py +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex/cli.py +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex/deploy/push.py +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex.egg-info/SOURCES.txt +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.65 → simplex-1.2.70}/simplex.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.70
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -18,7 +18,7 @@ Requires-Dist: requests
|
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
19
|
Requires-Dist: click
|
|
20
20
|
Provides-Extra: playwright
|
|
21
|
-
Requires-Dist: playwright>=1.0.0; extra == "playwright"
|
|
21
|
+
Requires-Dist: rebrowser-playwright>=1.0.0; extra == "playwright"
|
|
22
22
|
Dynamic: author
|
|
23
23
|
Dynamic: author-email
|
|
24
24
|
Dynamic: classifier
|
|
@@ -8,21 +8,21 @@ class PostDevelopCommand(develop):
|
|
|
8
8
|
"""Post-installation for development mode."""
|
|
9
9
|
def run(self):
|
|
10
10
|
develop.run(self)
|
|
11
|
-
# Only install playwright if playwright version is being installed
|
|
11
|
+
# Only install rebrowser-playwright if playwright version is being installed
|
|
12
12
|
if any('playwright' in arg for arg in sys.argv):
|
|
13
|
-
check_call(["playwright", "install"])
|
|
13
|
+
check_call(["rebrowser-playwright", "install"])
|
|
14
14
|
|
|
15
15
|
class PostInstallCommand(install):
|
|
16
16
|
"""Post-installation for installation mode."""
|
|
17
17
|
def run(self):
|
|
18
18
|
install.run(self)
|
|
19
|
-
# Only install playwright if playwright version is being installed
|
|
19
|
+
# Only install rebrowser-playwright if playwright version is being installed
|
|
20
20
|
if any('playwright' in arg for arg in sys.argv):
|
|
21
|
-
check_call(["playwright", "install"])
|
|
21
|
+
check_call(["rebrowser-playwright", "install"])
|
|
22
22
|
|
|
23
23
|
setup(
|
|
24
24
|
name="simplex",
|
|
25
|
-
version="1.2.
|
|
25
|
+
version="1.2.70",
|
|
26
26
|
packages=find_packages(),
|
|
27
27
|
package_data={
|
|
28
28
|
"simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
|
|
@@ -34,7 +34,7 @@ setup(
|
|
|
34
34
|
"click",
|
|
35
35
|
],
|
|
36
36
|
extras_require={
|
|
37
|
-
'playwright': ['playwright>=1.0.0'], # Full version with playwright
|
|
37
|
+
'playwright': ['rebrowser-playwright>=1.0.0'], # Full version with rebrowser-playwright
|
|
38
38
|
},
|
|
39
39
|
cmdclass={
|
|
40
40
|
'develop': PostDevelopCommand,
|
|
@@ -25,8 +25,53 @@ except ImportError:
|
|
|
25
25
|
ImportWarning
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
BASE_URL = "https://
|
|
29
|
-
|
|
28
|
+
BASE_URL = "https://api.simplex.sh"
|
|
29
|
+
|
|
30
|
+
class Playwright:
|
|
31
|
+
def __init__(self, simplex_instance):
|
|
32
|
+
self.simplex = simplex_instance
|
|
33
|
+
|
|
34
|
+
def click(self, locator: str, locator_type: str, exact: Optional[bool] = False,
|
|
35
|
+
element_index: Optional[str] = None, nth_index: Optional[int] = None,
|
|
36
|
+
locator_options: Optional[dict] = None):
|
|
37
|
+
|
|
38
|
+
if element_index and element_index not in ["first", "last", "nth"]:
|
|
39
|
+
raise ValueError("element_index must be 'first', 'last', or 'nth'")
|
|
40
|
+
|
|
41
|
+
if element_index=="nth" and not nth_index:
|
|
42
|
+
raise ValueError("nth_index is required when element_index is 'nth'")
|
|
43
|
+
|
|
44
|
+
data = {
|
|
45
|
+
'session_id': self.simplex.session_id,
|
|
46
|
+
'locator': locator,
|
|
47
|
+
'locator_type': locator_type,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if element_index:
|
|
51
|
+
data['element_index'] = element_index
|
|
52
|
+
data['nth_index'] = nth_index
|
|
53
|
+
|
|
54
|
+
if exact:
|
|
55
|
+
data['exact'] = exact
|
|
56
|
+
|
|
57
|
+
if locator_options:
|
|
58
|
+
data['locator_options'] = json.dumps(locator_options)
|
|
59
|
+
|
|
60
|
+
response = requests.post(
|
|
61
|
+
f"{BASE_URL}/playwright/click",
|
|
62
|
+
headers={
|
|
63
|
+
'x-api-key': self.simplex.api_key
|
|
64
|
+
},
|
|
65
|
+
data=data
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
if 'succeeded' not in response.json():
|
|
69
|
+
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?")
|
|
70
|
+
|
|
71
|
+
if "succeeded" in response.json():
|
|
72
|
+
return
|
|
73
|
+
else:
|
|
74
|
+
raise ValueError(f"Failed to click element: {response.json()['error']}")
|
|
30
75
|
|
|
31
76
|
class Simplex:
|
|
32
77
|
def __init__(self, api_key: str):
|
|
@@ -147,7 +192,6 @@ class Simplex:
|
|
|
147
192
|
},
|
|
148
193
|
data=data
|
|
149
194
|
)
|
|
150
|
-
|
|
151
195
|
if 'succeeded' not in response.json():
|
|
152
196
|
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?")
|
|
153
197
|
|
|
@@ -155,6 +199,7 @@ class Simplex:
|
|
|
155
199
|
return
|
|
156
200
|
else:
|
|
157
201
|
raise ValueError(f"Failed to goto url: {response.json()['error']}")
|
|
202
|
+
|
|
158
203
|
|
|
159
204
|
def click(self, element_description: str, cdp_url: str = None):
|
|
160
205
|
if not element_description or not element_description.strip():
|
|
@@ -182,6 +227,35 @@ class Simplex:
|
|
|
182
227
|
return response.json()["element_clicked"]
|
|
183
228
|
else:
|
|
184
229
|
raise ValueError(f"Failed to click element: {response.json()['error']}")
|
|
230
|
+
|
|
231
|
+
def select_dropdown_option(self, element_description: str, cdp_url: str = None):
|
|
232
|
+
if not element_description or not element_description.strip():
|
|
233
|
+
raise ValueError("element_description cannot be empty")
|
|
234
|
+
if not cdp_url and not self.session_id:
|
|
235
|
+
raise ValueError(f"Must call create_session before calling action select_from_dropdown with element_description='{element_description}'")
|
|
236
|
+
|
|
237
|
+
data = {'element_description': element_description}
|
|
238
|
+
|
|
239
|
+
if cdp_url:
|
|
240
|
+
data['cdp_url'] = cdp_url
|
|
241
|
+
else:
|
|
242
|
+
data['session_id'] = self.session_id
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
response = requests.post(
|
|
246
|
+
f"{BASE_URL}/select_dropdown_option",
|
|
247
|
+
headers={
|
|
248
|
+
'x-api-key': self.api_key
|
|
249
|
+
},
|
|
250
|
+
data=data
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
if 'succeeded' not in response.json():
|
|
254
|
+
raise ValueError(f"It looks like the select_dropdown_option action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
255
|
+
if response.json()["succeeded"]:
|
|
256
|
+
return response.json()["element_clicked"]
|
|
257
|
+
else:
|
|
258
|
+
raise ValueError(f"Failed to select dropdown option: {response.json()['error']}")
|
|
185
259
|
|
|
186
260
|
|
|
187
261
|
def scroll_to_element(self, element_description: str, cdp_url: str = None):
|
|
@@ -726,6 +800,7 @@ class Simplex:
|
|
|
726
800
|
},
|
|
727
801
|
data=data
|
|
728
802
|
)
|
|
803
|
+
|
|
729
804
|
# Get filename from Content-Disposition header
|
|
730
805
|
content_disposition = response.headers.get('Content-Disposition')
|
|
731
806
|
if content_disposition:
|
|
@@ -742,7 +817,11 @@ class Simplex:
|
|
|
742
817
|
except Exception:
|
|
743
818
|
raise ValueError("File failed to be parsed from Content-Disposition header.")
|
|
744
819
|
else:
|
|
745
|
-
|
|
820
|
+
try:
|
|
821
|
+
raise ValueError(response.json()["error"])
|
|
822
|
+
except:
|
|
823
|
+
raise ValueError("No Content-Disposition header found. File was not downloaded.")
|
|
824
|
+
|
|
746
825
|
|
|
747
826
|
# Check if response content is empty
|
|
748
827
|
if len(response.content) == 0:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.70
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -18,7 +18,7 @@ Requires-Dist: requests
|
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
19
|
Requires-Dist: click
|
|
20
20
|
Provides-Extra: playwright
|
|
21
|
-
Requires-Dist: playwright>=1.0.0; extra == "playwright"
|
|
21
|
+
Requires-Dist: rebrowser-playwright>=1.0.0; extra == "playwright"
|
|
22
22
|
Dynamic: author
|
|
23
23
|
Dynamic: author-email
|
|
24
24
|
Dynamic: classifier
|
|
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
|