simplex 1.2.38__py3-none-any.whl → 1.2.42__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 CHANGED
@@ -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")
simplex/simplex.py CHANGED
@@ -59,10 +59,15 @@ 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
+ if self.pw_browser:
68
+ self.pw_browser.close()
69
+ if self.pw:
70
+ self.pw.stop()
66
71
  if not self.session_id:
67
72
  return
68
73
  response = requests.post(
@@ -80,19 +85,21 @@ class Simplex:
80
85
  else:
81
86
  raise ValueError(f"Failed to close session: {response.json()['error']}")
82
87
 
83
- def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, session_data: Optional[str] = None):
88
+ def create_session(self, show_in_console: Optional[bool] = True, proxies: Optional[bool] = True, session_data: Optional[dict | str] = None):
84
89
  if session_data:
85
- try:
86
- # Try to parse as JSON string first
87
- session_data_dict = json.loads(session_data)
88
- except json.JSONDecodeError:
89
- # If parsing fails, treat as file path
90
+ if isinstance(session_data, dict):
91
+ session_data_dict = session_data
92
+ else:
90
93
  try:
91
- with open(session_data, 'r') as f:
92
- session_data_dict = json.load(f)
93
- except Exception as e:
94
- raise ValueError(f"Failed to load session data. Input must be valid JSON string or path to JSON file. Error: {str(e)}")
95
- print(session_data_dict)
94
+ # Try to parse as JSON string first
95
+ session_data_dict = json.loads(session_data)
96
+ except json.JSONDecodeError:
97
+ # If parsing fails, treat as file path
98
+ try:
99
+ with open(session_data, 'r') as f:
100
+ session_data_dict = json.load(f)
101
+ except Exception as e:
102
+ raise ValueError(f"Failed to load session data. Input must be valid JSON string, dictionary, or path to JSON file. Error: {str(e)}")
96
103
  response = requests.post(
97
104
  f"{BASE_URL}/create_session",
98
105
  headers={
@@ -117,6 +124,10 @@ class Simplex:
117
124
  raise ValueError(f"It looks like the session wasn't created successfully. Did you set your api_key when creating the Simplex class?")
118
125
  self.session_id = response_json['session_id']
119
126
  livestream_url = response_json['livestream_url']
127
+
128
+ # Start Playwright without using context manager
129
+ self.pw = sync_playwright().start()
130
+ self.pw_browser = self.pw.chromium.connect_over_cdp(response_json['connect_url'])
120
131
 
121
132
  if show_in_console:
122
133
  print(f"Livestream URL: {livestream_url}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simplex
3
- Version: 1.2.38
3
+ Version: 1.2.42
4
4
  Summary: Official Python SDK for Simplex API
5
5
  Home-page: https://simplex.sh
6
6
  Author: Simplex Labs, Inc.
@@ -0,0 +1,11 @@
1
+ simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
2
+ simplex/cli.py,sha256=0K_pzoVdF7vfTJPUONhFzzTvjZk2M7FZPpEONjZWJC8,2268
3
+ simplex/simplex.py,sha256=qJPzXzsRsAnIGUcri45Qqb_fOjS9e4KTX32V3ac158g,23130
4
+ simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
5
+ simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
6
+ simplex-1.2.42.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
7
+ simplex-1.2.42.dist-info/METADATA,sha256=v8X8x7EjupQqB2fHnU8X09ZN5LjsguQNMvfZ_LKT2CI,964
8
+ simplex-1.2.42.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
+ simplex-1.2.42.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
10
+ simplex-1.2.42.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
11
+ simplex-1.2.42.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- simplex/__init__.py,sha256=L_5i__xt_ZDkr6e-Wx9cr84t9sXpioOT7j01NJYJCTE,75
2
- simplex/cli.py,sha256=FcnZtxstZQS8bOshgT_RBSbEfCY2UkDU7FGBLZNmwAY,2307
3
- simplex/simplex.py,sha256=PWBkmTUJheeUSrPiNZN3g84GxQPECOKbB80ST-pWj4c,22621
4
- simplex/deploy/__init__.py,sha256=_JQ81F_Nu7hSAfMA691gzs6a4-8oZ-buJ9h3Au12BKw,96
5
- simplex/deploy/push.py,sha256=hRAbtFZaECKnBljaOLQ5nzJ6hk7tZgc1c7QdgxKQFoY,6123
6
- simplex-1.2.38.dist-info/LICENSE,sha256=Xh0SJjYZfNI71pCNMB40aKlBLLuOB0blx5xkTtufFNQ,1075
7
- simplex-1.2.38.dist-info/METADATA,sha256=u01fStZJsmwy_LIEn_XVbv0Ywec362PgPO3uhox2aXU,964
8
- simplex-1.2.38.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
- simplex-1.2.38.dist-info/entry_points.txt,sha256=3veL2w3c5vxb3dm8I_M8Fs-370n1ZnvD8uu1nSsL7z8,45
10
- simplex-1.2.38.dist-info/top_level.txt,sha256=cbMH1bYpN0A3gP-ecibPRHasHoqB-01T_2BUFS8p0CE,8
11
- simplex-1.2.38.dist-info/RECORD,,