simplex 1.2.37__py3-none-any.whl → 1.2.41__py3-none-any.whl
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/cli.py +1 -1
- simplex/simplex.py +42 -25
- {simplex-1.2.37.dist-info → simplex-1.2.41.dist-info}/METADATA +2 -11
- simplex-1.2.41.dist-info/RECORD +11 -0
- {simplex-1.2.37.dist-info → simplex-1.2.41.dist-info}/WHEEL +1 -1
- simplex-1.2.37.dist-info/RECORD +0 -11
- {simplex-1.2.37.dist-info → simplex-1.2.41.dist-info}/LICENSE +0 -0
- {simplex-1.2.37.dist-info → simplex-1.2.41.dist-info}/entry_points.txt +0 -0
- {simplex-1.2.37.dist-info → simplex-1.2.41.dist-info}/top_level.txt +0 -0
simplex/cli.py
CHANGED
|
@@ -64,7 +64,7 @@ def login(website, proxies):
|
|
|
64
64
|
|
|
65
65
|
animated_print(f"[SIMPLEX] Creating login session for {website}")
|
|
66
66
|
|
|
67
|
-
fileName = simplex.create_login_session(website
|
|
67
|
+
fileName = simplex.create_login_session(website)
|
|
68
68
|
|
|
69
69
|
if fileName:
|
|
70
70
|
animated_print(f"[SIMPLEX] Login session created and saved to {fileName}")
|
simplex/simplex.py
CHANGED
|
@@ -53,8 +53,6 @@ class Playwright:
|
|
|
53
53
|
return
|
|
54
54
|
else:
|
|
55
55
|
raise ValueError(f"Failed to click element: {response.json()['error']}")
|
|
56
|
-
|
|
57
|
-
|
|
58
56
|
|
|
59
57
|
class Simplex:
|
|
60
58
|
def __init__(self, api_key: str):
|
|
@@ -82,14 +80,36 @@ class Simplex:
|
|
|
82
80
|
else:
|
|
83
81
|
raise ValueError(f"Failed to close session: {response.json()['error']}")
|
|
84
82
|
|
|
85
|
-
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, session_data: Optional[str] = None):
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, session_data: Optional[dict | str] = None):
|
|
84
|
+
if session_data:
|
|
85
|
+
if isinstance(session_data, dict):
|
|
86
|
+
session_data_dict = session_data
|
|
87
|
+
else:
|
|
88
|
+
try:
|
|
89
|
+
# Try to parse as JSON string first
|
|
90
|
+
session_data_dict = json.loads(session_data)
|
|
91
|
+
except json.JSONDecodeError:
|
|
92
|
+
# If parsing fails, treat as file path
|
|
93
|
+
try:
|
|
94
|
+
with open(session_data, 'r') as f:
|
|
95
|
+
session_data_dict = json.load(f)
|
|
96
|
+
except Exception as e:
|
|
97
|
+
raise ValueError(f"Failed to load session data. Input must be valid JSON string, dictionary, or path to JSON file. Error: {str(e)}")
|
|
98
|
+
response = requests.post(
|
|
99
|
+
f"{BASE_URL}/create_session",
|
|
100
|
+
headers={
|
|
101
|
+
'x-api-key': self.api_key
|
|
102
|
+
},
|
|
103
|
+
data={'proxies': proxies, 'session_data': json.dumps(session_data_dict)}
|
|
104
|
+
)
|
|
105
|
+
else:
|
|
106
|
+
response = requests.post(
|
|
107
|
+
f"{BASE_URL}/create_session",
|
|
108
|
+
headers={
|
|
109
|
+
'x-api-key': self.api_key
|
|
110
|
+
},
|
|
111
|
+
data={'proxies': proxies}
|
|
112
|
+
)
|
|
93
113
|
# Check for non-200 status code
|
|
94
114
|
if response.status_code != 200:
|
|
95
115
|
raise ValueError(f"Create session request failed with status code {response.status_code}: {response.text}")
|
|
@@ -293,12 +313,12 @@ class Simplex:
|
|
|
293
313
|
else:
|
|
294
314
|
data['session_id'] = self.session_id
|
|
295
315
|
|
|
296
|
-
response = requests.
|
|
316
|
+
response = requests.post(
|
|
297
317
|
f"{BASE_URL}/extract-text",
|
|
298
318
|
headers={
|
|
299
319
|
'x-api-key': self.api_key
|
|
300
320
|
},
|
|
301
|
-
|
|
321
|
+
data=data
|
|
302
322
|
)
|
|
303
323
|
if 'succeeded' not in response.json():
|
|
304
324
|
raise ValueError(f"It looks like the extract_text action failed to return a response. Did you set your api_key when creating the Simplex class?")
|
|
@@ -382,7 +402,7 @@ class Simplex:
|
|
|
382
402
|
else:
|
|
383
403
|
raise ValueError(f"Failed to wait: {response.json()['error']}")
|
|
384
404
|
|
|
385
|
-
def create_login_session(self, url: str, save_directory: Optional[str] = None
|
|
405
|
+
def create_login_session(self, url: str, save_directory: Optional[str] = None):
|
|
386
406
|
def get_website_name(url: str) -> str:
|
|
387
407
|
"""Extract website name from URL"""
|
|
388
408
|
from urllib.parse import urlparse
|
|
@@ -393,8 +413,7 @@ class Simplex:
|
|
|
393
413
|
return netloc.replace(".", "_")
|
|
394
414
|
|
|
395
415
|
with sync_playwright() as p:
|
|
396
|
-
browser = p.chromium.
|
|
397
|
-
user_data_dir="",
|
|
416
|
+
browser = p.chromium.launch(
|
|
398
417
|
channel="chrome",
|
|
399
418
|
headless=False,
|
|
400
419
|
args=[
|
|
@@ -404,16 +423,13 @@ class Simplex:
|
|
|
404
423
|
ignore_default_args=['--enable-automation']
|
|
405
424
|
)
|
|
406
425
|
|
|
407
|
-
#
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
# Create main page for login
|
|
412
|
-
main_page = browser.new_page()
|
|
426
|
+
# Create context and pages
|
|
427
|
+
context = browser.new_context()
|
|
428
|
+
main_page = context.new_page()
|
|
413
429
|
main_page.goto(url)
|
|
414
430
|
|
|
415
|
-
# Create control page
|
|
416
|
-
control_page =
|
|
431
|
+
# Create control page in same context
|
|
432
|
+
control_page = context.new_page()
|
|
417
433
|
control_page.set_content("""
|
|
418
434
|
<html>
|
|
419
435
|
<body style="display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f5f5f5;">
|
|
@@ -443,7 +459,8 @@ class Simplex:
|
|
|
443
459
|
}
|
|
444
460
|
""")
|
|
445
461
|
|
|
446
|
-
|
|
462
|
+
# Use context.storage_state() instead of browser.storage_state()
|
|
463
|
+
storage = context.storage_state()
|
|
447
464
|
if save_directory:
|
|
448
465
|
filename = os.path.join(save_directory, get_website_name(url) + "_session_data.json")
|
|
449
466
|
else:
|
|
@@ -576,4 +593,4 @@ class Simplex:
|
|
|
576
593
|
if response_json['succeeded']:
|
|
577
594
|
return response_json['exists'], response_json['reasoning']
|
|
578
595
|
else:
|
|
579
|
-
raise ValueError(f"Failed to check if element exists: {response_json['error']}")
|
|
596
|
+
raise ValueError(f"Failed to check if element exists: {response_json['error']}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.41
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -18,15 +18,6 @@ Requires-Dist: requests
|
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
19
|
Requires-Dist: click
|
|
20
20
|
Requires-Dist: playwright
|
|
21
|
-
Dynamic: author
|
|
22
|
-
Dynamic: author-email
|
|
23
|
-
Dynamic: classifier
|
|
24
|
-
Dynamic: description
|
|
25
|
-
Dynamic: description-content-type
|
|
26
|
-
Dynamic: home-page
|
|
27
|
-
Dynamic: requires-dist
|
|
28
|
-
Dynamic: requires-python
|
|
29
|
-
Dynamic: summary
|
|
30
21
|
|
|
31
22
|
# Simplex AI Python SDK
|
|
32
23
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
|
|
2
|
+
simplex/cli.py,sha256=FcnZtxstZQS8bOshgT_RBSbEfCY2UkDU7FGBLZNmwAY,2307
|
|
3
|
+
simplex/simplex.py,sha256=NHFOokIA7GYmbJ0J-Ul-qf3aVM3xa5frQN-9MV9GoYw,22758
|
|
4
|
+
simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
|
|
5
|
+
simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
|
|
6
|
+
simplex-1.2.41.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
7
|
+
simplex-1.2.41.dist-info/METADATA,sha256=Tt9Pd3kbyxQO0JjMLtzrNIv6i47YolrqvT-lKKioZBI,767
|
|
8
|
+
simplex-1.2.41.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
9
|
+
simplex-1.2.41.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
10
|
+
simplex-1.2.41.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
11
|
+
simplex-1.2.41.dist-info/RECORD,,
|
simplex-1.2.37.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
|
|
2
|
-
simplex/cli.py,sha256=DxZMiX-mqhy1cWJhf75YQs49GfZediueFuxyEhBFpLk,2324
|
|
3
|
-
simplex/simplex.py,sha256=8JcmId0SQ32GamEAQTWQlafQpa8oswmXM6E3Plfn-9k,21853
|
|
4
|
-
simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
|
|
5
|
-
simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
|
|
6
|
-
simplex-1.2.37.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
|
|
7
|
-
simplex-1.2.37.dist-info/METADATA,sha256=DTpFDlzDtuQsYAjR-2I4CmGUlObOq3MD814DTqCAQSs,964
|
|
8
|
-
simplex-1.2.37.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
-
simplex-1.2.37.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
|
|
10
|
-
simplex-1.2.37.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
|
|
11
|
-
simplex-1.2.37.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|