simplex 1.2.55__tar.gz → 1.2.57__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.55 → simplex-1.2.57}/PKG-INFO +1 -1
- {simplex-1.2.55 → simplex-1.2.57}/setup.py +1 -1
- {simplex-1.2.55 → simplex-1.2.57}/simplex/simplex.py +11 -7
- {simplex-1.2.55 → simplex-1.2.57}/simplex.egg-info/PKG-INFO +1 -1
- {simplex-1.2.55 → simplex-1.2.57}/simplex.egg-info/SOURCES.txt +1 -2
- simplex-1.2.55/tests/test.py +0 -23
- {simplex-1.2.55 → simplex-1.2.57}/LICENSE +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/README.md +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/setup.cfg +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex/__init__.py +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex/cli.py +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex/deploy/push.py +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex.egg-info/requires.txt +0 -0
- {simplex-1.2.55 → simplex-1.2.57}/simplex.egg-info/top_level.txt +0 -0
|
@@ -110,7 +110,10 @@ class Simplex:
|
|
|
110
110
|
else:
|
|
111
111
|
raise ValueError(f"Failed to close session: {response.json()['error']}")
|
|
112
112
|
|
|
113
|
-
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, session_data: Optional[dict | str] = None):
|
|
113
|
+
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, workflow_name: Optional[str] = None, session_data: Optional[dict | str] = None):
|
|
114
|
+
if self.session_id:
|
|
115
|
+
raise ValueError("A session is already active. Please close the current session before creating a new one.")
|
|
116
|
+
|
|
114
117
|
if session_data:
|
|
115
118
|
if isinstance(session_data, dict):
|
|
116
119
|
session_data_dict = session_data
|
|
@@ -130,7 +133,7 @@ class Simplex:
|
|
|
130
133
|
headers={
|
|
131
134
|
'x-api-key': self.api_key
|
|
132
135
|
},
|
|
133
|
-
data={'proxies': proxies, 'session_data': json.dumps(session_data_dict)}
|
|
136
|
+
data={'proxies': proxies, 'session_data': json.dumps(session_data_dict), 'workflow_name': workflow_name}
|
|
134
137
|
)
|
|
135
138
|
else:
|
|
136
139
|
response = requests.post(
|
|
@@ -138,7 +141,7 @@ class Simplex:
|
|
|
138
141
|
headers={
|
|
139
142
|
'x-api-key': self.api_key
|
|
140
143
|
},
|
|
141
|
-
data={'proxies': proxies}
|
|
144
|
+
data={'proxies': proxies, "workflow_name": workflow_name}
|
|
142
145
|
)
|
|
143
146
|
# Check for non-200 status code
|
|
144
147
|
if response.status_code != 200:
|
|
@@ -356,12 +359,13 @@ class Simplex:
|
|
|
356
359
|
},
|
|
357
360
|
data=data
|
|
358
361
|
)
|
|
359
|
-
|
|
362
|
+
response_json = response.json()
|
|
363
|
+
if 'succeeded' not in response_json:
|
|
360
364
|
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?")
|
|
361
|
-
if
|
|
362
|
-
return
|
|
365
|
+
if response_json["succeeded"]:
|
|
366
|
+
return response_json["text"]
|
|
363
367
|
else:
|
|
364
|
-
raise ValueError(f"Failed to extract text: {
|
|
368
|
+
raise ValueError(f"Failed to extract text: {response_json['error']}")
|
|
365
369
|
|
|
366
370
|
def extract_image(self, element_description: str, cdp_url: str = None):
|
|
367
371
|
if not cdp_url and not self.session_id:
|
simplex-1.2.55/tests/test.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from simplex import Simplex
|
|
2
|
-
import os
|
|
3
|
-
from dotenv import load_dotenv
|
|
4
|
-
import time
|
|
5
|
-
from playwright.async_api import Page
|
|
6
|
-
|
|
7
|
-
import asyncio
|
|
8
|
-
import os
|
|
9
|
-
import dotenv
|
|
10
|
-
|
|
11
|
-
dotenv.load_dotenv()
|
|
12
|
-
|
|
13
|
-
async def main():
|
|
14
|
-
simplex = Simplex(os.getenv("SIMPLEX_API_KEY"))
|
|
15
|
-
|
|
16
|
-
simplex.create_session()
|
|
17
|
-
simplex.goto("https://gmail.com")
|
|
18
|
-
simplex.type("test@gmail.com")
|
|
19
|
-
simplex.press_enter()
|
|
20
|
-
simplex.wait(1000000)
|
|
21
|
-
if __name__ == "__main__":
|
|
22
|
-
asyncio.run(main())
|
|
23
|
-
|
|
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
|