simplex 1.2.41__tar.gz → 1.2.43__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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.41
3
+ Version: 1.2.43
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -18,6 +18,15 @@ 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
21
30
 
22
31
  # Simplex AI Python SDK
23
32
 
@@ -17,7 +17,7 @@ class PostInstallCommand(install):
17
17
 
18
18
  setup(
19
19
  name="simplex",
20
- version="1.2.41",
20
+ version="1.2.43",
21
21
  packages=find_packages(),
22
22
  package_data={
23
23
  "simplex": ["browser_agent/dom/*.js"], # Include JS files in the dom directory
@@ -47,9 +47,8 @@ def run(directory):
47
47
 
48
48
  @cli.command()
49
49
  @click.argument('website')
50
- @click.option('--proxies', type=bool, default=True, help='Enable proxy support (default: True)')
51
- def login(website, proxies):
52
- """Capture login session for a website"""
50
+ def login(website):
51
+ """Capture login session for a website. See https://simplex.sh/docs/getting-started for more information."""
53
52
  try:
54
53
  # Initialize Simplex with API key from environment
55
54
  api_key = os.getenv("SIMPLEX_API_KEY")
@@ -59,10 +59,24 @@ class Simplex:
59
59
  self.api_key = api_key
60
60
  self.session_id = None
61
61
  atexit.register(self.close_session)
62
-
63
62
  self.playwright = Playwright(self)
64
-
63
+ self.pw_browser = None
64
+ self.pw = None
65
+
65
66
  def close_session(self):
67
+ try:
68
+ if self.pw_browser:
69
+ try:
70
+ self.pw_browser.close()
71
+ self.pw_browser = None
72
+ except Exception as e:
73
+ print(f"Failed to close pw_browser: {e}")
74
+ if self.pw:
75
+ try:
76
+ self.pw.stop()
77
+ self.pw = None
78
+ except Exception as e:
79
+ print(f"Failed to stop pw: {e}")
66
80
  if not self.session_id:
67
81
  return
68
82
  response = requests.post(
@@ -119,6 +133,10 @@ class Simplex:
119
133
  raise ValueError(f"It looks like the session wasn't created successfully. Did you set your api_key when creating the Simplex class?")
120
134
  self.session_id = response_json['session_id']
121
135
  livestream_url = response_json['livestream_url']
136
+
137
+ # Start Playwright without using context manager
138
+ self.pw = sync_playwright().start()
139
+ self.pw_browser = self.pw.chromium.connect_over_cdp(response_json['connect_url'])
122
140
 
123
141
  if show_in_console:
124
142
  print(f"Livestream URL: {livestream_url}")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.41
3
+ Version: 1.2.43
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -18,6 +18,15 @@ 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
21
30
 
22
31
  # Simplex AI Python SDK
23
32
 
@@ -0,0 +1,23 @@
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
+
@@ -1,75 +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
- 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
-
File without changes
File without changes
File without changes
File without changes
File without changes