patchright-cli 0.3.0__py3-none-any.whl → 0.3.1__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.
@@ -1,3 +1,3 @@
1
1
  """patchright-cli — Undetected browser automation CLI using Patchright."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.1"
patchright_cli/cli.py CHANGED
@@ -154,6 +154,7 @@ def _print_help():
154
154
  click.echo(" --headless Run headless (default: headed)")
155
155
  click.echo(" --persistent Use persistent profile")
156
156
  click.echo(" --profile=<path> Custom profile directory")
157
+ click.echo(" --proxy=<url> Proxy server (e.g. http://host:port, socks5://host:port)")
157
158
  click.echo(" -s=<name> Named session (default: 'default')")
158
159
  click.echo(" --port=<n> Daemon port (default: 9321)")
159
160
  click.echo(" --version Show version")
@@ -231,6 +232,7 @@ def main():
231
232
  headless = False
232
233
  persistent = False
233
234
  profile = None
235
+ proxy = None
234
236
  session_name = "default"
235
237
  port = DEFAULT_PORT
236
238
 
@@ -248,6 +250,11 @@ def main():
248
250
  elif arg == "--profile" and i + 1 < len(argv):
249
251
  i += 1
250
252
  profile = argv[i]
253
+ elif arg.startswith("--proxy="):
254
+ proxy = arg.split("=", 1)[1]
255
+ elif arg == "--proxy" and i + 1 < len(argv):
256
+ i += 1
257
+ proxy = argv[i]
251
258
  elif arg.startswith("-s="):
252
259
  session_name = arg.split("=", 1)[1]
253
260
  elif arg == "-s" and i + 1 < len(argv):
@@ -330,6 +337,8 @@ def main():
330
337
  options["persistent"] = True
331
338
  if profile:
332
339
  options["profile"] = profile
340
+ if proxy:
341
+ options["proxy"] = proxy
333
342
 
334
343
  # Ensure daemon is running (auto-start for 'open', require for others)
335
344
  try:
patchright_cli/daemon.py CHANGED
@@ -137,6 +137,7 @@ class DaemonState:
137
137
  headless: bool | None = None,
138
138
  persistent: bool = True,
139
139
  profile: str | None = None,
140
+ proxy: str | None = None,
140
141
  url: str | None = None,
141
142
  ) -> Session:
142
143
  if name in self.sessions:
@@ -151,14 +152,18 @@ class DaemonState:
151
152
  profile_dir = profile or str(Path.home() / ".patchright-cli" / "profiles" / name)
152
153
  Path(profile_dir).mkdir(parents=True, exist_ok=True)
153
154
 
155
+ launch_kwargs = {
156
+ "channel": "chrome",
157
+ "headless": use_headless,
158
+ "no_viewport": True,
159
+ "args": ["--disable-blink-features=AutomationControlled"],
160
+ }
161
+ if proxy:
162
+ launch_kwargs["proxy"] = {"server": proxy}
163
+
154
164
  context = await self.playwright.chromium.launch_persistent_context(
155
165
  profile_dir,
156
- channel="chrome",
157
- headless=use_headless,
158
- no_viewport=True,
159
- args=[
160
- "--disable-blink-features=AutomationControlled",
161
- ],
166
+ **launch_kwargs,
162
167
  )
163
168
 
164
169
  pages = context.pages or []
@@ -263,6 +268,7 @@ async def handle_command(state: DaemonState, msg: dict) -> dict:
263
268
  headless=headless,
264
269
  persistent=options.get("persistent", True),
265
270
  profile=options.get("profile"),
271
+ proxy=options.get("proxy"),
266
272
  url=url,
267
273
  )
268
274
  return await _page_info(session, cwd)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchright-cli
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Anti-detect browser automation CLI using Patchright (undetected Playwright fork)
5
5
  Project-URL: Homepage, https://github.com/AhaiMk01/patchright-cli
6
6
  Project-URL: Repository, https://github.com/AhaiMk01/patchright-cli
@@ -0,0 +1,10 @@
1
+ patchright_cli/__init__.py,sha256=EPqY-eBKEojjl1y9dwsndFlrKpBqB0Wz6OBMfewzVWE,100
2
+ patchright_cli/__main__.py,sha256=iVuBuI_rPOENLhffOEHoS7JWCDBQciqT1kPXjRuhbZ4,127
3
+ patchright_cli/cli.py,sha256=pbwyLdszogGpgSiCEBW5lrsTssOEJaQzbbx7o1HduL4,14137
4
+ patchright_cli/daemon.py,sha256=AhGUiiuvAH197sDMhBsHvvDvB8YMQiYmX4XD4ie4oWM,44323
5
+ patchright_cli/snapshot.py,sha256=JuXO3dN6-JNSQ0-lLEXIkg3YqGXW6Ul4I6KskdPygtQ,13621
6
+ patchright_cli-0.3.1.dist-info/METADATA,sha256=Va7G26o7qU29yC0vcF3yZFsi6BVjxuchtviG5Nsdc0E,15498
7
+ patchright_cli-0.3.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
8
+ patchright_cli-0.3.1.dist-info/entry_points.txt,sha256=Syh904eOQA8ylakyqIvG4LmIHx3LMjgeNcnFap3O0NQ,59
9
+ patchright_cli-0.3.1.dist-info/licenses/LICENSE,sha256=adszqL4YR4pQUrc7LeAFxeg5Mc2cvljXp7QPlzKVWm8,10760
10
+ patchright_cli-0.3.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- patchright_cli/__init__.py,sha256=x00uFL1mYAaxrLk5nVfsCs1mmaj2zv7BV3asq5SckUU,100
2
- patchright_cli/__main__.py,sha256=iVuBuI_rPOENLhffOEHoS7JWCDBQciqT1kPXjRuhbZ4,127
3
- patchright_cli/cli.py,sha256=yPK6QU_1DJnQ_H91K7WS5yyUf4igd6FnC-_OxCswo7M,13794
4
- patchright_cli/daemon.py,sha256=Syl7UniGcQxKDSpn94moH8jB7uVxAchhyvksLAncaTM,44125
5
- patchright_cli/snapshot.py,sha256=JuXO3dN6-JNSQ0-lLEXIkg3YqGXW6Ul4I6KskdPygtQ,13621
6
- patchright_cli-0.3.0.dist-info/METADATA,sha256=aM7Arg4o03YDah57wVQgA6xmEUABDoeFwx5NtU66tvI,15498
7
- patchright_cli-0.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
8
- patchright_cli-0.3.0.dist-info/entry_points.txt,sha256=Syh904eOQA8ylakyqIvG4LmIHx3LMjgeNcnFap3O0NQ,59
9
- patchright_cli-0.3.0.dist-info/licenses/LICENSE,sha256=adszqL4YR4pQUrc7LeAFxeg5Mc2cvljXp7QPlzKVWm8,10760
10
- patchright_cli-0.3.0.dist-info/RECORD,,