simplex 1.2.65__tar.gz → 1.2.69__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.65
3
+ Version: 1.2.69
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -18,17 +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"
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
21
+ Requires-Dist: rebrowser-playwright>=1.0.0; extra == "playwright"
32
22
 
33
23
  # Simplex AI Python SDK
34
24
 
@@ -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.65",
25
+ version="1.2.69",
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://simplex-dev--api-server-and-container-service-fastapi-app.modal.run"
29
- # BASE_URL = "https://api.simplex.sh"
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):
@@ -155,6 +200,7 @@ class Simplex:
155
200
  return
156
201
  else:
157
202
  raise ValueError(f"Failed to goto url: {response.json()['error']}")
203
+
158
204
 
159
205
  def click(self, element_description: str, cdp_url: str = None):
160
206
  if not element_description or not element_description.strip():
@@ -182,6 +228,35 @@ class Simplex:
182
228
  return response.json()["element_clicked"]
183
229
  else:
184
230
  raise ValueError(f"Failed to click element: {response.json()['error']}")
231
+
232
+ def select_dropdown_option(self, element_description: str, cdp_url: str = None):
233
+ if not element_description or not element_description.strip():
234
+ raise ValueError("element_description cannot be empty")
235
+ if not cdp_url and not self.session_id:
236
+ raise ValueError(f"Must call create_session before calling action select_from_dropdown with element_description='{element_description}'")
237
+
238
+ data = {'element_description': element_description}
239
+
240
+ if cdp_url:
241
+ data['cdp_url'] = cdp_url
242
+ else:
243
+ data['session_id'] = self.session_id
244
+
245
+
246
+ response = requests.post(
247
+ f"{BASE_URL}/select_dropdown_option",
248
+ headers={
249
+ 'x-api-key': self.api_key
250
+ },
251
+ data=data
252
+ )
253
+
254
+ if 'succeeded' not in response.json():
255
+ 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?")
256
+ if response.json()["succeeded"]:
257
+ return response.json()["element_clicked"]
258
+ else:
259
+ raise ValueError(f"Failed to select dropdown option: {response.json()['error']}")
185
260
 
186
261
 
187
262
  def scroll_to_element(self, element_description: str, cdp_url: str = None):
@@ -726,6 +801,7 @@ class Simplex:
726
801
  },
727
802
  data=data
728
803
  )
804
+
729
805
  # Get filename from Content-Disposition header
730
806
  content_disposition = response.headers.get('Content-Disposition')
731
807
  if content_disposition:
@@ -742,7 +818,11 @@ class Simplex:
742
818
  except Exception:
743
819
  raise ValueError("File failed to be parsed from Content-Disposition header.")
744
820
  else:
745
- raise ValueError("No Content-Disposition header found. File was not downloaded.")
821
+ try:
822
+ raise ValueError(response.json()["error"])
823
+ except:
824
+ raise ValueError("No Content-Disposition header found. File was not downloaded.")
825
+
746
826
 
747
827
  # Check if response content is empty
748
828
  if len(response.content) == 0:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: simplex
3
- Version: 1.2.65
3
+ Version: 1.2.69
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -18,17 +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"
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
21
+ Requires-Dist: rebrowser-playwright>=1.0.0; extra == "playwright"
32
22
 
33
23
  # Simplex AI Python SDK
34
24
 
@@ -4,4 +4,4 @@ python-dotenv
4
4
  click
5
5
 
6
6
  [playwright]
7
- playwright>=1.0.0
7
+ rebrowser-playwright>=1.0.0
File without changes
File without changes
File without changes
File without changes
File without changes