simplex 1.2.35__tar.gz → 1.2.37__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.35 → simplex-1.2.37}/PKG-INFO +12 -2
- {simplex-1.2.35 → simplex-1.2.37}/setup.py +21 -1
- {simplex-1.2.35 → simplex-1.2.37}/simplex/simplex.py +4 -4
- {simplex-1.2.35 → simplex-1.2.37}/simplex.egg-info/PKG-INFO +12 -2
- {simplex-1.2.35 → simplex-1.2.37}/simplex.egg-info/requires.txt +1 -0
- simplex-1.2.37/tests/test.py +75 -0
- simplex-1.2.35/tests/test.py +0 -22
- {simplex-1.2.35 → simplex-1.2.37}/LICENSE +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/README.md +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/pyproject.toml +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/setup.cfg +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex/__init__.py +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex/cli.py +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex/deploy/push.py +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex.egg-info/SOURCES.txt +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.35 → simplex-1.2.37}/simplex.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.37
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -17,6 +17,16 @@ Requires-Dist: colorama
|
|
|
17
17
|
Requires-Dist: requests
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
19
|
Requires-Dist: click
|
|
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
|
|
20
30
|
|
|
21
31
|
# Simplex AI Python SDK
|
|
22
32
|
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
|
+
from setuptools.command.develop import develop
|
|
3
|
+
from setuptools.command.install import install
|
|
4
|
+
from subprocess import check_call
|
|
5
|
+
|
|
6
|
+
class PostDevelopCommand(develop):
|
|
7
|
+
"""Post-installation for development mode."""
|
|
8
|
+
def run(self):
|
|
9
|
+
develop.run(self)
|
|
10
|
+
check_call(["playwright", "install"])
|
|
11
|
+
|
|
12
|
+
class PostInstallCommand(install):
|
|
13
|
+
"""Post-installation for installation mode."""
|
|
14
|
+
def run(self):
|
|
15
|
+
install.run(self)
|
|
16
|
+
check_call(["playwright", "install"])
|
|
2
17
|
|
|
3
18
|
setup(
|
|
4
19
|
name="simplex",
|
|
5
|
-
version="1.2.
|
|
20
|
+
version="1.2.37",
|
|
6
21
|
packages=find_packages(),
|
|
7
22
|
package_data={
|
|
8
23
|
"simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
|
|
@@ -12,7 +27,12 @@ setup(
|
|
|
12
27
|
"requests",
|
|
13
28
|
"python-dotenv",
|
|
14
29
|
"click",
|
|
30
|
+
"playwright",
|
|
15
31
|
],
|
|
32
|
+
cmdclass={
|
|
33
|
+
'develop': PostDevelopCommand,
|
|
34
|
+
'install': PostInstallCommand,
|
|
35
|
+
},
|
|
16
36
|
entry_points={
|
|
17
37
|
'console_scripts': [
|
|
18
38
|
'simplex=simplex.cli:main',
|
|
@@ -82,18 +82,18 @@ class Simplex:
|
|
|
82
82
|
else:
|
|
83
83
|
raise ValueError(f"Failed to close session: {response.json()['error']}")
|
|
84
84
|
|
|
85
|
-
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True):
|
|
85
|
+
def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, session_data: Optional[str] = None):
|
|
86
86
|
response = requests.post(
|
|
87
87
|
f"{BASE_URL}/create_session",
|
|
88
88
|
headers={
|
|
89
89
|
'x-api-key': self.api_key
|
|
90
90
|
},
|
|
91
|
-
data={'proxies': proxies}
|
|
91
|
+
data={'proxies': proxies, 'session_data': session_data}
|
|
92
92
|
)
|
|
93
93
|
# Check for non-200 status code
|
|
94
94
|
if response.status_code != 200:
|
|
95
95
|
raise ValueError(f"Create session request failed with status code {response.status_code}: {response.text}")
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
response_json = response.json()
|
|
98
98
|
if 'session_id' not in response_json:
|
|
99
99
|
raise ValueError(f"It looks like the session wasn't created successfully. Did you set your api_key when creating the Simplex class?")
|
|
@@ -103,7 +103,7 @@ class Simplex:
|
|
|
103
103
|
if show_in_console:
|
|
104
104
|
print(f"Livestream URL: {livestream_url}")
|
|
105
105
|
|
|
106
|
-
return livestream_url
|
|
106
|
+
return self.session_id, livestream_url
|
|
107
107
|
|
|
108
108
|
def goto(self, url: str, cdp_url: str = None):
|
|
109
109
|
if not cdp_url and not self.session_id:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: simplex
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.37
|
|
4
4
|
Summary: Official Python SDK for Simplex API
|
|
5
5
|
Home-page: https://simplex.sh
|
|
6
6
|
Author: Simplex Labs, Inc.
|
|
@@ -17,6 +17,16 @@ Requires-Dist: colorama
|
|
|
17
17
|
Requires-Dist: requests
|
|
18
18
|
Requires-Dist: python-dotenv
|
|
19
19
|
Requires-Dist: click
|
|
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
|
|
20
30
|
|
|
21
31
|
# Simplex AI Python SDK
|
|
22
32
|
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
load_dotenv()
|
|
8
|
+
|
|
9
|
+
def login():
|
|
10
|
+
simplex = Simplex(api_key=os.getenv("SIMPLEX_API_KEY"))
|
|
11
|
+
simplex.create_session(proxies=True)
|
|
12
|
+
simplex.goto("https://bill.com")
|
|
13
|
+
|
|
14
|
+
simplex.wait(100000)
|
|
15
|
+
|
|
16
|
+
import asyncio
|
|
17
|
+
from playwright.async_api import async_playwright
|
|
18
|
+
from hyperbrowser import AsyncHyperbrowser
|
|
19
|
+
from hyperbrowser.models.session import CreateSessionParams, ScreenConfig
|
|
20
|
+
import os
|
|
21
|
+
import dotenv
|
|
22
|
+
|
|
23
|
+
dotenv.load_dotenv()
|
|
24
|
+
|
|
25
|
+
async def main():
|
|
26
|
+
client = AsyncHyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
|
|
27
|
+
# Create a session and connect to it using Pyppeteer
|
|
28
|
+
session = await client.sessions.create(
|
|
29
|
+
params=CreateSessionParams(
|
|
30
|
+
use_stealth=True,
|
|
31
|
+
use_proxy=True,
|
|
32
|
+
operating_systems=["macos"],
|
|
33
|
+
device=["desktop"],
|
|
34
|
+
locales=["en"],
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
print(session.live_url)
|
|
38
|
+
async with async_playwright() as p:
|
|
39
|
+
|
|
40
|
+
browser = await p.chromium.connect_over_cdp(session.ws_endpoint)
|
|
41
|
+
|
|
42
|
+
# Create context with permissions
|
|
43
|
+
context = await browser.new_context(
|
|
44
|
+
)
|
|
45
|
+
import json
|
|
46
|
+
page = await context.new_page()
|
|
47
|
+
|
|
48
|
+
session_data = json.load(open("bill_session.json"))
|
|
49
|
+
await page.goto("https://bill.com")
|
|
50
|
+
await restore_session_data(page, session_data)
|
|
51
|
+
await page.wait_for_timeout(10000000)
|
|
52
|
+
|
|
53
|
+
async def restore_session_data(page: Page, session_data: dict):
|
|
54
|
+
# First set cookies
|
|
55
|
+
if 'cookies' in session_data:
|
|
56
|
+
await page.context.add_cookies(session_data['cookies'])
|
|
57
|
+
|
|
58
|
+
# Now set localStorage
|
|
59
|
+
if 'localStorage' in session_data:
|
|
60
|
+
for key, value in session_data['localStorage'].items():
|
|
61
|
+
await page.evaluate("""({ key, value }) => {
|
|
62
|
+
localStorage.setItem(key, value);
|
|
63
|
+
}""", {"key": key, "value": value})
|
|
64
|
+
|
|
65
|
+
# Set sessionStorage
|
|
66
|
+
if 'sessionStorage' in session_data:
|
|
67
|
+
for key, value in session_data['sessionStorage'].items():
|
|
68
|
+
await page.evaluate("""({ key, value }) => {
|
|
69
|
+
sessionStorage.setItem(key, value);
|
|
70
|
+
}""", {"key": key, "value": value})
|
|
71
|
+
print("restored")
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
asyncio.run(main())
|
|
75
|
+
|
simplex-1.2.35/tests/test.py
DELETED
|
@@ -1,22 +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://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()
|
|
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
|