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.
- {simplex-1.2.32 → simplex-1.2.33}/PKG-INFO +1 -1
- {simplex-1.2.32 → simplex-1.2.33}/setup.py +1 -1
- {simplex-1.2.32 → simplex-1.2.33}/simplex/simplex.py +18 -6
- {simplex-1.2.32 → simplex-1.2.33}/simplex.egg-info/PKG-INFO +1 -1
- simplex-1.2.33/tests/test.py +22 -0
- simplex-1.2.32/tests/test.py +0 -41
- {simplex-1.2.32 → simplex-1.2.33}/LICENSE +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/README.md +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/pyproject.toml +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/setup.cfg +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex/__init__.py +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex/cli.py +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex/deploy/push.py +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex.egg-info/SOURCES.txt +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex.egg-info/requires.txt +0 -0
- {simplex-1.2.32 → simplex-1.2.33}/simplex.egg-info/top_level.txt +0 -0
|
@@ -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,
|
|
348
|
-
|
|
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
|
-
|
|
351
|
-
session_data
|
|
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(
|
|
367
|
+
'session_data': json.dumps(session_data_dict)
|
|
356
368
|
}
|
|
357
369
|
if cdp_url:
|
|
358
370
|
data['cdp_url'] = cdp_url
|
|
@@ -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()
|
simplex-1.2.32/tests/test.py
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|