simplex 1.2.32__tar.gz → 1.2.33__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.32
3
+ Version: 1.2.33
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.32",
5
+ version="1.2.33",
6
6
  packages=find_packages(),
7
7
  package_data={
8
8
  "simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
@@ -344,15 +344,27 @@ class Simplex:
344
344
  else:
345
345
  raise ValueError(f"Failed to create login session: {response.json()['error']}")
346
346
 
347
- def restore_login_session(self, session_data_filepath: str, cdp_url: str = None):
348
- filename = session_data_filepath
347
+ def restore_login_session(self, session_data: str, cdp_url: str = None):
348
+ """
349
+ Restore a login session from either a file path or a JSON string.
349
350
 
350
- with open(filename, 'r') as f:
351
- session_data = json.load(f)
351
+ Args:
352
+ session_data: Either a file path to JSON file or a JSON string
353
+ cdp_url: Optional CDP URL for remote debugging
354
+ """
355
+ try:
356
+ # Try to parse as JSON string first
357
+ session_data_dict = json.loads(session_data)
358
+ except json.JSONDecodeError:
359
+ # If parsing fails, treat as file path
360
+ try:
361
+ with open(session_data, 'r') as f:
362
+ session_data_dict = json.load(f)
363
+ except Exception as e:
364
+ raise ValueError(f"Failed to load session data. Input must be valid JSON string or path to JSON file. Error: {str(e)}")
352
365
 
353
- # Serialize the data to JSON string
354
366
  data = {
355
- 'session_data': json.dumps(session_data) # Serialize the session_data
367
+ 'session_data': json.dumps(session_data_dict)
356
368
  }
357
369
  if cdp_url:
358
370
  data['cdp_url'] = cdp_url
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.32
3
+ Version: 1.2.33
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -0,0 +1,22 @@
1
+ from simplex import Simplex
2
+ import os
3
+ from dotenv import load_dotenv
4
+ import time
5
+
6
+ load_dotenv()
7
+
8
+ def login():
9
+ simplex = Simplex(api_key=os.getenv("SIMPLEX_API_KEY"))
10
+ simplex.create_session(proxies=False)
11
+ simplex.goto("https://dropbox.com")
12
+
13
+ with open("dropbox_com_session_data.json", "r") as f:
14
+ session_data = f.read()
15
+ simplex.restore_login_session(session_data=session_data)
16
+
17
+ simplex.wait(1000)
18
+ print(simplex.extract_text("footer texts"))
19
+ print(simplex.wait(5000))
20
+
21
+ if __name__ == "__main__":
22
+ login()
@@ -1,41 +0,0 @@
1
- from simplex import Simplex
2
- import os
3
- from dotenv import load_dotenv
4
- import time
5
-
6
- load_dotenv()
7
-
8
- def login():
9
- simplex = Simplex(api_key=os.getenv("SIMPLEX_API_KEY"))
10
- simplex.create_session(proxies=False)
11
- simplex.goto("https://github.com/login")
12
- simplex.wait(1000)
13
- # simplex.goto("https://browser-tests-alpha.vercel.app/api/upload-test")
14
- # simplex.wait(10)
15
- # print(simplex.create_login_session("https://auth.leboncoin.fr/login/"))
16
- print(simplex.extract_text("footer texts"))
17
- print(simplex.wait(5000))
18
-
19
- # simplex.goto("https://dropbox.com/")
20
- # simplex.click("Upload or drop")
21
- # simplex.click_and_upload("File", "ycombinator.svg")
22
- # print(simplex.exists("Download button"))
23
- # files = simplex.click_and_download("Download File")
24
- # import base64
25
- # print(files)
26
- # # Decode base64 string to bytes
27
- # file_bytes = base64.b64decode(files['b64'])
28
-
29
- # # Create downloads directory if it doesn't exist
30
- # os.makedirs('downloads', exist_ok=True)
31
-
32
- # # Write bytes to file
33
- # with open(os.path.join('downloads', files['filename']), 'wb') as f:
34
- # f.write(file_bytes)
35
-
36
- # simplex.goto("https://file-examples.com/wp-content/storage/2018/04/file_example_AVI_480_750kB.avi")
37
- # print(simplex.restore_login_session("zillow_com_session_data.json"))
38
- # simplex.goto("https://zillow.com")
39
-
40
- if __name__ == "__main__":
41
- login()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes