gecko-web-runtime-client 1.4.1__tar.gz → 1.4.2__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.
Files changed (44) hide show
  1. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/PACKAGE_README.md +5 -1
  2. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/PKG-INFO +7 -3
  3. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/api/runtime.py +45 -2
  4. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime_client.egg-info/PKG-INFO +7 -3
  5. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime_client.egg-info/requires.txt +1 -1
  6. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/pyproject.toml +2 -2
  7. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/README.md +0 -0
  8. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/__init__.py +0 -0
  9. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/__main__.py +0 -0
  10. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/_leases.py +0 -0
  11. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/api/__init__.py +0 -0
  12. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/api/context.py +0 -0
  13. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/api/page.py +0 -0
  14. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/api/pool.py +0 -0
  15. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/data_plane.py +0 -0
  16. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/diagnostics/__init__.py +0 -0
  17. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/diagnostics/gc_cc.py +0 -0
  18. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/diagnostics/logging.py +0 -0
  19. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/diagnostics/memory.py +0 -0
  20. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/diagnostics/metrics.py +0 -0
  21. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/diagnostics/resources.py +0 -0
  22. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/http.py +0 -0
  23. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/installer.py +0 -0
  24. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/iocp_pipe.py +0 -0
  25. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/media_capture.py +0 -0
  26. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/media_downloader.py +0 -0
  27. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/models/__init__.py +0 -0
  28. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/models/navigation.py +0 -0
  29. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/network/__init__.py +0 -0
  30. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/network/_urls.py +0 -0
  31. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/network/client.py +0 -0
  32. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/network/exceptions.py +0 -0
  33. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/network/models.py +0 -0
  34. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/network/transport.py +0 -0
  35. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/pipe.py +0 -0
  36. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/session.py +0 -0
  37. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/workflows/__init__.py +0 -0
  38. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/workflows/turnstile.py +0 -0
  39. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/workflows/wechat.py +0 -0
  40. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime/workflows/wechat_challenge.py +0 -0
  41. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime_client.egg-info/SOURCES.txt +0 -0
  42. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime_client.egg-info/dependency_links.txt +0 -0
  43. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/gecko_web_runtime_client.egg-info/top_level.txt +0 -0
  44. {gecko_web_runtime_client-1.4.1 → gecko_web_runtime_client-1.4.2}/setup.cfg +0 -0
@@ -46,7 +46,11 @@ asyncio.run(main())
46
46
  ```
47
47
 
48
48
  Set `WPR_RUNTIME_DIR`, `WPR_WORKER_EXE`, `WPR_PERSISTENT_PROFILE_DIR`, and
49
- `WPR_WIDEVINE_SOURCE_PROFILE` before creating the downloader. For a bounded
49
+ `WPR_ENABLE_CDM=1` before creating the downloader. Widevine is installed by
50
+ Firefox's official GMP installer into the persistent WPR profile; no existing
51
+ Firefox profile or component is imported. This requires the Worker build with
52
+ `runtime.widevine_start/status` support (Runtime 155.0.8 or later).
53
+ For a bounded
50
54
  smoke test of a longer page, use `sample_seconds=120` instead of
51
55
  `expected_duration`. The downloader keeps a `checkpoint.json`; rerunning with
52
56
  the same output directory returns a completed result without starting another
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gecko-web-runtime-client
3
- Version: 1.4.1
3
+ Version: 1.4.2
4
4
  Summary: Thin Python client for the Firefox-derived WPR Gecko Worker protocol
5
5
  Author: WPR project
6
6
  License: MPL-2.0-compatible client; see the runtime bundle notices
@@ -8,7 +8,7 @@ Project-URL: Repository, https://github.com/childclm/gecko-web-runtime-client
8
8
  Project-URL: Documentation, https://github.com/childclm/gecko-web-runtime-client/blob/main/README.md
9
9
  Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: wpr-runtime-core<0.3,>=0.2.0
11
+ Requires-Dist: wpr-runtime-core<0.3,>=0.2.2
12
12
  Requires-Dist: wpr-http<0.3,>=0.2.0
13
13
  Provides-Extra: diagnostics
14
14
  Requires-Dist: loguru>=0.7.2; extra == "diagnostics"
@@ -61,7 +61,11 @@ asyncio.run(main())
61
61
  ```
62
62
 
63
63
  Set `WPR_RUNTIME_DIR`, `WPR_WORKER_EXE`, `WPR_PERSISTENT_PROFILE_DIR`, and
64
- `WPR_WIDEVINE_SOURCE_PROFILE` before creating the downloader. For a bounded
64
+ `WPR_ENABLE_CDM=1` before creating the downloader. Widevine is installed by
65
+ Firefox's official GMP installer into the persistent WPR profile; no existing
66
+ Firefox profile or component is imported. This requires the Worker build with
67
+ `runtime.widevine_start/status` support (Runtime 155.0.8 or later).
68
+ For a bounded
65
69
  smoke test of a longer page, use `sample_seconds=120` instead of
66
70
  `expected_duration`. The downloader keeps a `checkpoint.json`; rerunning with
67
71
  the same output directory returns a completed result without starting another
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import asyncio
5
6
  from dataclasses import dataclass
6
7
  from pathlib import Path
7
8
  from typing import Any
@@ -64,8 +65,50 @@ class AsyncGeckoRuntime:
64
65
  async def __aenter__(self) -> "AsyncGeckoRuntime":
65
66
  self._session = AsyncGeckoWorkerSession(self.config, self.fpfile, self.proxy)
66
67
  await self._session.__aenter__()
68
+ worker_config = getattr(getattr(self._session, "_sync", None), "config", self.config)
69
+ if getattr(worker_config, "enable_widevine", False):
70
+ try:
71
+ await self.ensure_widevine()
72
+ except BaseException:
73
+ await self._session.__aexit__(None, None, None)
74
+ self._session = None
75
+ raise
67
76
  return self
68
77
 
78
+ async def ensure_widevine(self, *, timeout: float = 120) -> dict[str, Any]:
79
+ """Download, verify and register Widevine using Firefox's GMP installer.
80
+
81
+ Requires enable_widevine=True and a persistent WPR profile. A ready
82
+ result confirms registration; EME/CDM process readiness is a separate
83
+ playback capability check.
84
+ """
85
+ from wpr_runtime_core.session import require_ok
86
+ if self._session is None:
87
+ raise RuntimeError("AsyncGeckoRuntime is not open")
88
+ if not self._session._sync.config.enable_widevine:
89
+ raise ValueError("Set RuntimeConfig(enable_widevine=True) before starting the Worker")
90
+ if timeout <= 0:
91
+ raise ValueError("timeout must be positive")
92
+ last_state: dict[str, Any] = {}
93
+ async def wait():
94
+ nonlocal last_state
95
+ value = require_ok("runtime.widevine_start", await self._session.request(
96
+ {"method": "runtime.widevine_start"}))
97
+ while True:
98
+ last_state = value
99
+ if value.get("status") == "ready":
100
+ return value
101
+ if value.get("status") == "failed":
102
+ error = value.get("error", {})
103
+ raise RuntimeError(f"Widevine [{error.get('code')}] stage={value.get('stage')}: {error.get('message')}")
104
+ await asyncio.sleep(0.2)
105
+ value = require_ok("runtime.widevine_status", await self._session.request(
106
+ {"method": "runtime.widevine_status"}))
107
+ try:
108
+ return await asyncio.wait_for(wait(), timeout)
109
+ except asyncio.TimeoutError as exc:
110
+ raise TimeoutError(f"Widevine installation did not finish within {timeout}s; last_state={last_state}") from exc
111
+
69
112
  async def new_page(self) -> Page:
70
113
  if self._session is None:
71
114
  raise RuntimeError("AsyncGeckoRuntime is not open")
@@ -123,8 +166,8 @@ class AsyncGeckoRuntime:
123
166
  old_pid = getattr(getattr(self._session, "_sync", None), "process", None)
124
167
  old_pid = getattr(old_pid, "pid", None)
125
168
  await self._session.__aexit__(None, None, None)
126
- self._session = AsyncGeckoWorkerSession(self.config, self.fpfile, self.proxy)
127
- await self._session.__aenter__()
169
+ self._session = None
170
+ await self.__aenter__()
128
171
  new_pid = getattr(getattr(self._session, "_sync", None), "process", None)
129
172
  new_pid = getattr(new_pid, "pid", None)
130
173
  self._completed_jobs = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gecko-web-runtime-client
3
- Version: 1.4.1
3
+ Version: 1.4.2
4
4
  Summary: Thin Python client for the Firefox-derived WPR Gecko Worker protocol
5
5
  Author: WPR project
6
6
  License: MPL-2.0-compatible client; see the runtime bundle notices
@@ -8,7 +8,7 @@ Project-URL: Repository, https://github.com/childclm/gecko-web-runtime-client
8
8
  Project-URL: Documentation, https://github.com/childclm/gecko-web-runtime-client/blob/main/README.md
9
9
  Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: wpr-runtime-core<0.3,>=0.2.0
11
+ Requires-Dist: wpr-runtime-core<0.3,>=0.2.2
12
12
  Requires-Dist: wpr-http<0.3,>=0.2.0
13
13
  Provides-Extra: diagnostics
14
14
  Requires-Dist: loguru>=0.7.2; extra == "diagnostics"
@@ -61,7 +61,11 @@ asyncio.run(main())
61
61
  ```
62
62
 
63
63
  Set `WPR_RUNTIME_DIR`, `WPR_WORKER_EXE`, `WPR_PERSISTENT_PROFILE_DIR`, and
64
- `WPR_WIDEVINE_SOURCE_PROFILE` before creating the downloader. For a bounded
64
+ `WPR_ENABLE_CDM=1` before creating the downloader. Widevine is installed by
65
+ Firefox's official GMP installer into the persistent WPR profile; no existing
66
+ Firefox profile or component is imported. This requires the Worker build with
67
+ `runtime.widevine_start/status` support (Runtime 155.0.8 or later).
68
+ For a bounded
65
69
  smoke test of a longer page, use `sample_seconds=120` instead of
66
70
  `expected_duration`. The downloader keeps a `checkpoint.json`; rerunning with
67
71
  the same output directory returns a completed result without starting another
@@ -1,4 +1,4 @@
1
- wpr-runtime-core<0.3,>=0.2.0
1
+ wpr-runtime-core<0.3,>=0.2.2
2
2
  wpr-http<0.3,>=0.2.0
3
3
 
4
4
  [diagnostics]
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gecko-web-runtime-client"
7
- version = "1.4.1"
7
+ version = "1.4.2"
8
8
  description = "Thin Python client for the Firefox-derived WPR Gecko Worker protocol"
9
9
  readme = "PACKAGE_README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = {text = "MPL-2.0-compatible client; see the runtime bundle notices"}
12
12
  authors = [{name = "WPR project"}]
13
- dependencies = ["wpr-runtime-core>=0.2.0,<0.3", "wpr-http>=0.2.0,<0.3"]
13
+ dependencies = ["wpr-runtime-core>=0.2.2,<0.3", "wpr-http>=0.2.0,<0.3"]
14
14
 
15
15
  [project.urls]
16
16
  Repository = "https://github.com/childclm/gecko-web-runtime-client"