simplex 1.2.5__tar.gz → 1.2.7__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.5
3
+ Version: 1.2.7
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="simplex",
5
- version="1.2.5",
5
+ version="1.2.7",
6
6
  packages=find_packages(),
7
7
  package_data={
8
8
  "simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
@@ -2,7 +2,8 @@ import os
2
2
  import requests
3
3
  import atexit
4
4
 
5
- BASE_URL = "https://api.simplex.sh"
5
+ BASE_URL = "http://api.simplex.sh"
6
+ import json
6
7
 
7
8
  class Simplex:
8
9
  def __init__(self, api_key: str):
@@ -67,7 +68,7 @@ class Simplex:
67
68
  },
68
69
  data=data
69
70
  )
70
- print(response.json())
71
+ return response.json()
71
72
 
72
73
  def click(self, element_description: str, cdp_url: str = None):
73
74
  if not cdp_url and not self.session_id:
@@ -87,7 +88,7 @@ class Simplex:
87
88
  },
88
89
  data=data
89
90
  )
90
- print(response.json())
91
+ return response.json()
91
92
 
92
93
  def type(self, text: str, cdp_url: str = None):
93
94
  if not cdp_url and not self.session_id:
@@ -107,7 +108,7 @@ class Simplex:
107
108
  },
108
109
  data=data
109
110
  )
110
- print(response.json())
111
+ return response.json()
111
112
 
112
113
  def press_enter(self, cdp_url: str = None):
113
114
  if not cdp_url and not self.session_id:
@@ -127,7 +128,7 @@ class Simplex:
127
128
  },
128
129
  data=data
129
130
  )
130
- print(response.json())
131
+ return response.json()
131
132
 
132
133
  def extract_bbox(self, element_description: str, cdp_url: str = None):
133
134
  if not cdp_url and not self.session_id:
@@ -193,11 +194,12 @@ class Simplex:
193
194
  )
194
195
  return response.json()
195
196
 
196
- def scroll(self, pixels: int, cdp_url: str = None):
197
+ def scroll(self, pixels: float, cdp_url: str = None):
197
198
  if not cdp_url and not self.session_id:
198
199
  raise ValueError(f"Must call create_session before calling action scroll with pixels={pixels}")
199
200
 
200
201
  data = {'pixels': pixels}
202
+ print(data)
201
203
 
202
204
  if cdp_url:
203
205
  data['cdp_url'] = cdp_url
@@ -231,4 +233,58 @@ class Simplex:
231
233
  },
232
234
  data=data
233
235
  )
234
- return response.json()
236
+ return response.json()
237
+
238
+ def capture_login_session(self, url: str):
239
+ response = requests.post(
240
+ f"{BASE_URL}/capture_login_session",
241
+ headers={
242
+ 'x-api-key': self.api_key
243
+ },
244
+ data={'url': url}
245
+ )
246
+ return response.json()
247
+
248
+ def restore_login_session(self, session_data_filepath: str, cdp_url: str = None):
249
+ filename = session_data_filepath
250
+
251
+ with open(filename, 'r') as f:
252
+ session_data = json.load(f)
253
+
254
+ # Serialize the data to JSON string
255
+ data = {
256
+ 'session_data': json.dumps(session_data) # Serialize the session_data
257
+ }
258
+ if cdp_url:
259
+ data['cdp_url'] = cdp_url
260
+ else:
261
+ data['session_id'] = self.session_id
262
+
263
+ response = requests.post(
264
+ f"{BASE_URL}/restore_login_session",
265
+ headers={
266
+ 'x-api-key': self.api_key
267
+ },
268
+ data=data
269
+ )
270
+ return response.json()
271
+
272
+ def run_agent(self, prompt: str, cdp_url: str = None):
273
+ if not cdp_url and not self.session_id:
274
+ raise ValueError(f"Must call create_session before calling action run_agent with and prompt='{prompt}'")
275
+
276
+ data = {'prompt': prompt}
277
+
278
+ if cdp_url:
279
+ data['cdp_url'] = cdp_url
280
+ else:
281
+ data['session_id'] = self.session_id
282
+
283
+ response = requests.post(
284
+ f"{BASE_URL}/run-agent",
285
+ headers={
286
+ 'x-api-key': self.api_key
287
+ },
288
+ data=data
289
+ )
290
+ return response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.5
3
+ Version: 1.2.7
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
File without changes
File without changes