parsek-cdp 0.1.0__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.
- parsek_cdp/__init__.py +55 -0
- parsek_cdp/_logging.py +49 -0
- parsek_cdp/cdp/__init__.py +247 -0
- parsek_cdp/cdp/accessibility/__init__.py +15 -0
- parsek_cdp/cdp/accessibility/events.py +35 -0
- parsek_cdp/cdp/accessibility/functions.py +202 -0
- parsek_cdp/cdp/accessibility/types.py +235 -0
- parsek_cdp/cdp/animation/__init__.py +15 -0
- parsek_cdp/cdp/animation/events.py +52 -0
- parsek_cdp/cdp/animation/functions.py +140 -0
- parsek_cdp/cdp/animation/types.py +113 -0
- parsek_cdp/cdp/audits/__init__.py +15 -0
- parsek_cdp/cdp/audits/events.py +21 -0
- parsek_cdp/cdp/audits/functions.py +95 -0
- parsek_cdp/cdp/audits/types.py +1051 -0
- parsek_cdp/cdp/autofill/__init__.py +15 -0
- parsek_cdp/cdp/autofill/events.py +27 -0
- parsek_cdp/cdp/autofill/functions.py +64 -0
- parsek_cdp/cdp/autofill/types.py +108 -0
- parsek_cdp/cdp/backgroundservice/__init__.py +15 -0
- parsek_cdp/cdp/backgroundservice/events.py +40 -0
- parsek_cdp/cdp/backgroundservice/functions.py +59 -0
- parsek_cdp/cdp/backgroundservice/types.py +63 -0
- parsek_cdp/cdp/bluetoothemulation/__init__.py +15 -0
- parsek_cdp/cdp/bluetoothemulation/events.py +70 -0
- parsek_cdp/cdp/bluetoothemulation/functions.py +247 -0
- parsek_cdp/cdp/bluetoothemulation/types.py +120 -0
- parsek_cdp/cdp/browser/__init__.py +15 -0
- parsek_cdp/cdp/browser/events.py +46 -0
- parsek_cdp/cdp/browser/functions.py +350 -0
- parsek_cdp/cdp/browser/types.py +158 -0
- parsek_cdp/cdp/cachestorage/__init__.py +15 -0
- parsek_cdp/cdp/cachestorage/events.py +13 -0
- parsek_cdp/cdp/cachestorage/functions.py +126 -0
- parsek_cdp/cdp/cachestorage/types.py +89 -0
- parsek_cdp/cdp/cast/__init__.py +15 -0
- parsek_cdp/cdp/cast/events.py +38 -0
- parsek_cdp/cdp/cast/functions.py +77 -0
- parsek_cdp/cdp/cast/types.py +23 -0
- parsek_cdp/cdp/console/__init__.py +15 -0
- parsek_cdp/cdp/console/events.py +22 -0
- parsek_cdp/cdp/console/functions.py +36 -0
- parsek_cdp/cdp/console/types.py +30 -0
- parsek_cdp/cdp/css/__init__.py +15 -0
- parsek_cdp/cdp/css/events.py +79 -0
- parsek_cdp/cdp/css/functions.py +788 -0
- parsek_cdp/cdp/css/types.py +742 -0
- parsek_cdp/cdp/debugger/__init__.py +15 -0
- parsek_cdp/cdp/debugger/events.py +164 -0
- parsek_cdp/cdp/debugger/functions.py +663 -0
- parsek_cdp/cdp/debugger/types.py +171 -0
- parsek_cdp/cdp/deviceaccess/__init__.py +15 -0
- parsek_cdp/cdp/deviceaccess/events.py +30 -0
- parsek_cdp/cdp/deviceaccess/functions.py +54 -0
- parsek_cdp/cdp/deviceaccess/types.py +28 -0
- parsek_cdp/cdp/deviceorientation/__init__.py +15 -0
- parsek_cdp/cdp/deviceorientation/events.py +13 -0
- parsek_cdp/cdp/deviceorientation/functions.py +35 -0
- parsek_cdp/cdp/deviceorientation/types.py +10 -0
- parsek_cdp/cdp/dom/__init__.py +15 -0
- parsek_cdp/cdp/dom/events.py +228 -0
- parsek_cdp/cdp/dom/functions.py +1033 -0
- parsek_cdp/cdp/dom/types.py +293 -0
- parsek_cdp/cdp/domdebugger/__init__.py +15 -0
- parsek_cdp/cdp/domdebugger/events.py +13 -0
- parsek_cdp/cdp/domdebugger/functions.py +155 -0
- parsek_cdp/cdp/domdebugger/types.py +57 -0
- parsek_cdp/cdp/domsnapshot/__init__.py +15 -0
- parsek_cdp/cdp/domsnapshot/events.py +13 -0
- parsek_cdp/cdp/domsnapshot/functions.py +111 -0
- parsek_cdp/cdp/domsnapshot/types.py +312 -0
- parsek_cdp/cdp/domstorage/__init__.py +15 -0
- parsek_cdp/cdp/domstorage/events.py +60 -0
- parsek_cdp/cdp/domstorage/functions.py +79 -0
- parsek_cdp/cdp/domstorage/types.py +30 -0
- parsek_cdp/cdp/emulation/__init__.py +15 -0
- parsek_cdp/cdp/emulation/events.py +17 -0
- parsek_cdp/cdp/emulation/functions.py +688 -0
- parsek_cdp/cdp/emulation/types.py +305 -0
- parsek_cdp/cdp/eventbreakpoints/__init__.py +15 -0
- parsek_cdp/cdp/eventbreakpoints/events.py +13 -0
- parsek_cdp/cdp/eventbreakpoints/functions.py +41 -0
- parsek_cdp/cdp/eventbreakpoints/types.py +10 -0
- parsek_cdp/cdp/extensions/__init__.py +15 -0
- parsek_cdp/cdp/extensions/events.py +13 -0
- parsek_cdp/cdp/extensions/functions.py +118 -0
- parsek_cdp/cdp/extensions/types.py +19 -0
- parsek_cdp/cdp/fedcm/__init__.py +15 -0
- parsek_cdp/cdp/fedcm/events.py +45 -0
- parsek_cdp/cdp/fedcm/functions.py +93 -0
- parsek_cdp/cdp/fedcm/types.py +72 -0
- parsek_cdp/cdp/fetch/__init__.py +15 -0
- parsek_cdp/cdp/fetch/events.py +82 -0
- parsek_cdp/cdp/fetch/functions.py +215 -0
- parsek_cdp/cdp/fetch/types.py +81 -0
- parsek_cdp/cdp/filesystem/__init__.py +15 -0
- parsek_cdp/cdp/filesystem/events.py +13 -0
- parsek_cdp/cdp/filesystem/functions.py +36 -0
- parsek_cdp/cdp/filesystem/types.py +54 -0
- parsek_cdp/cdp/headlessexperimental/__init__.py +15 -0
- parsek_cdp/cdp/headlessexperimental/events.py +13 -0
- parsek_cdp/cdp/headlessexperimental/functions.py +77 -0
- parsek_cdp/cdp/headlessexperimental/types.py +24 -0
- parsek_cdp/cdp/heapprofiler/__init__.py +15 -0
- parsek_cdp/cdp/heapprofiler/events.py +65 -0
- parsek_cdp/cdp/heapprofiler/functions.py +193 -0
- parsek_cdp/cdp/heapprofiler/types.py +57 -0
- parsek_cdp/cdp/indexeddb/__init__.py +15 -0
- parsek_cdp/cdp/indexeddb/events.py +13 -0
- parsek_cdp/cdp/indexeddb/functions.py +232 -0
- parsek_cdp/cdp/indexeddb/types.py +120 -0
- parsek_cdp/cdp/input/__init__.py +15 -0
- parsek_cdp/cdp/input/events.py +25 -0
- parsek_cdp/cdp/input/functions.py +361 -0
- parsek_cdp/cdp/input/types.py +87 -0
- parsek_cdp/cdp/inspector/__init__.py +15 -0
- parsek_cdp/cdp/inspector/events.py +41 -0
- parsek_cdp/cdp/inspector/functions.py +27 -0
- parsek_cdp/cdp/inspector/types.py +10 -0
- parsek_cdp/cdp/io/__init__.py +15 -0
- parsek_cdp/cdp/io/events.py +13 -0
- parsek_cdp/cdp/io/functions.py +77 -0
- parsek_cdp/cdp/io/types.py +13 -0
- parsek_cdp/cdp/layertree/__init__.py +15 -0
- parsek_cdp/cdp/layertree/events.py +36 -0
- parsek_cdp/cdp/layertree/functions.py +178 -0
- parsek_cdp/cdp/layertree/types.py +104 -0
- parsek_cdp/cdp/log/__init__.py +15 -0
- parsek_cdp/cdp/log/events.py +22 -0
- parsek_cdp/cdp/log/functions.py +54 -0
- parsek_cdp/cdp/log/types.py +57 -0
- parsek_cdp/cdp/media/__init__.py +15 -0
- parsek_cdp/cdp/media/events.py +87 -0
- parsek_cdp/cdp/media/functions.py +27 -0
- parsek_cdp/cdp/media/types.py +101 -0
- parsek_cdp/cdp/memory/__init__.py +15 -0
- parsek_cdp/cdp/memory/events.py +13 -0
- parsek_cdp/cdp/memory/functions.py +164 -0
- parsek_cdp/cdp/memory/types.py +71 -0
- parsek_cdp/cdp/mixins/__init__.py +21 -0
- parsek_cdp/cdp/mixins/datatype.py +123 -0
- parsek_cdp/cdp/mixins/event.py +78 -0
- parsek_cdp/cdp/mixins/namespace.py +31 -0
- parsek_cdp/cdp/network/__init__.py +15 -0
- parsek_cdp/cdp/network/events.py +726 -0
- parsek_cdp/cdp/network/functions.py +734 -0
- parsek_cdp/cdp/network/types.py +1247 -0
- parsek_cdp/cdp/overlay/__init__.py +15 -0
- parsek_cdp/cdp/overlay/events.py +54 -0
- parsek_cdp/cdp/overlay/functions.py +407 -0
- parsek_cdp/cdp/overlay/types.py +328 -0
- parsek_cdp/cdp/page/__init__.py +15 -0
- parsek_cdp/cdp/page/events.py +416 -0
- parsek_cdp/cdp/page/functions.py +1081 -0
- parsek_cdp/cdp/page/types.py +1088 -0
- parsek_cdp/cdp/performance/__init__.py +15 -0
- parsek_cdp/cdp/performance/events.py +24 -0
- parsek_cdp/cdp/performance/functions.py +63 -0
- parsek_cdp/cdp/performance/types.py +22 -0
- parsek_cdp/cdp/performancetimeline/__init__.py +15 -0
- parsek_cdp/cdp/performancetimeline/events.py +22 -0
- parsek_cdp/cdp/performancetimeline/functions.py +30 -0
- parsek_cdp/cdp/performancetimeline/types.py +85 -0
- parsek_cdp/cdp/preload/__init__.py +15 -0
- parsek_cdp/cdp/preload/events.py +116 -0
- parsek_cdp/cdp/preload/functions.py +25 -0
- parsek_cdp/cdp/preload/types.py +267 -0
- parsek_cdp/cdp/profiler/__init__.py +15 -0
- parsek_cdp/cdp/profiler/events.py +64 -0
- parsek_cdp/cdp/profiler/functions.py +134 -0
- parsek_cdp/cdp/profiler/types.py +105 -0
- parsek_cdp/cdp/pwa/__init__.py +15 -0
- parsek_cdp/cdp/pwa/events.py +13 -0
- parsek_cdp/cdp/pwa/functions.py +196 -0
- parsek_cdp/cdp/pwa/types.py +45 -0
- parsek_cdp/cdp/runtime/__init__.py +15 -0
- parsek_cdp/cdp/runtime/events.py +123 -0
- parsek_cdp/cdp/runtime/functions.py +552 -0
- parsek_cdp/cdp/runtime/types.py +319 -0
- parsek_cdp/cdp/schema/__init__.py +15 -0
- parsek_cdp/cdp/schema/events.py +13 -0
- parsek_cdp/cdp/schema/functions.py +32 -0
- parsek_cdp/cdp/schema/types.py +22 -0
- parsek_cdp/cdp/security/__init__.py +15 -0
- parsek_cdp/cdp/security/events.py +64 -0
- parsek_cdp/cdp/security/functions.py +66 -0
- parsek_cdp/cdp/security/types.py +168 -0
- parsek_cdp/cdp/serviceworker/__init__.py +15 -0
- parsek_cdp/cdp/serviceworker/events.py +43 -0
- parsek_cdp/cdp/serviceworker/functions.py +115 -0
- parsek_cdp/cdp/serviceworker/types.py +95 -0
- parsek_cdp/cdp/storage/__init__.py +15 -0
- parsek_cdp/cdp/storage/events.py +288 -0
- parsek_cdp/cdp/storage/functions.py +571 -0
- parsek_cdp/cdp/storage/types.py +656 -0
- parsek_cdp/cdp/systeminfo/__init__.py +15 -0
- parsek_cdp/cdp/systeminfo/events.py +13 -0
- parsek_cdp/cdp/systeminfo/functions.py +75 -0
- parsek_cdp/cdp/systeminfo/types.py +132 -0
- parsek_cdp/cdp/target/__init__.py +15 -0
- parsek_cdp/cdp/target/events.py +109 -0
- parsek_cdp/cdp/target/functions.py +424 -0
- parsek_cdp/cdp/target/types.py +83 -0
- parsek_cdp/cdp/tethering/__init__.py +15 -0
- parsek_cdp/cdp/tethering/events.py +22 -0
- parsek_cdp/cdp/tethering/functions.py +35 -0
- parsek_cdp/cdp/tethering/types.py +10 -0
- parsek_cdp/cdp/tracing/__init__.py +15 -0
- parsek_cdp/cdp/tracing/events.py +61 -0
- parsek_cdp/cdp/tracing/functions.py +119 -0
- parsek_cdp/cdp/tracing/types.py +81 -0
- parsek_cdp/cdp/webaudio/__init__.py +15 -0
- parsek_cdp/cdp/webaudio/events.py +184 -0
- parsek_cdp/cdp/webaudio/functions.py +51 -0
- parsek_cdp/cdp/webaudio/types.py +155 -0
- parsek_cdp/cdp/webauthn/__init__.py +15 -0
- parsek_cdp/cdp/webauthn/events.py +69 -0
- parsek_cdp/cdp/webauthn/functions.py +214 -0
- parsek_cdp/cdp/webauthn/types.py +96 -0
- parsek_cdp/core/__init__.py +18 -0
- parsek_cdp/core/browser.py +240 -0
- parsek_cdp/core/browser_context.py +58 -0
- parsek_cdp/core/element.py +405 -0
- parsek_cdp/core/feature.py +376 -0
- parsek_cdp/core/frame.py +351 -0
- parsek_cdp/core/pagable.py +175 -0
- parsek_cdp/core/page.py +163 -0
- parsek_cdp/core/target.py +490 -0
- parsek_cdp/features/__init__.py +14 -0
- parsek_cdp/features/request_listener/__init__.py +256 -0
- parsek_cdp/features/request_listener/events.py +48 -0
- parsek_cdp/features/request_listener/types.py +235 -0
- parsek_cdp/generate.py +642 -0
- parsek_cdp/parsek/__init__.py +18 -0
- parsek_cdp/parsek/events.py +38 -0
- parsek_cdp/parsek/types.py +36 -0
- parsek_cdp/py.typed +0 -0
- parsek_cdp-0.1.0.dist-info/METADATA +277 -0
- parsek_cdp-0.1.0.dist-info/RECORD +242 -0
- parsek_cdp-0.1.0.dist-info/WHEEL +5 -0
- parsek_cdp-0.1.0.dist-info/licenses/LICENSE +201 -0
- parsek_cdp-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"""Commands for the Browser domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import DataType, FieldMeta, encode
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import (
|
|
11
|
+
Bounds,
|
|
12
|
+
BrowserCommandId,
|
|
13
|
+
BrowserContextID,
|
|
14
|
+
Histogram,
|
|
15
|
+
PermissionDescriptor,
|
|
16
|
+
PermissionSetting,
|
|
17
|
+
PermissionType,
|
|
18
|
+
PrivacySandboxAPI,
|
|
19
|
+
WindowID,
|
|
20
|
+
)
|
|
21
|
+
from ..target.types import TargetID as Target_TargetID
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class GetVersionReturn(DataType):
|
|
25
|
+
"""Return value of :meth:`Browser.get_version`."""
|
|
26
|
+
protocol_version: str
|
|
27
|
+
product: str
|
|
28
|
+
revision: str
|
|
29
|
+
user_agent: str
|
|
30
|
+
js_version: str
|
|
31
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
32
|
+
FieldMeta('protocol_version', 'protocolVersion', False, 'primitive'),
|
|
33
|
+
FieldMeta('product', 'product', False, 'primitive'),
|
|
34
|
+
FieldMeta('revision', 'revision', False, 'primitive'),
|
|
35
|
+
FieldMeta('user_agent', 'userAgent', False, 'primitive'),
|
|
36
|
+
FieldMeta('js_version', 'jsVersion', False, 'primitive'),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class GetBrowserCommandLineReturn(DataType):
|
|
42
|
+
"""Return value of :meth:`Browser.get_browser_command_line`."""
|
|
43
|
+
arguments: List[str]
|
|
44
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
45
|
+
FieldMeta('arguments', 'arguments', False, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass
|
|
50
|
+
class GetHistogramsReturn(DataType):
|
|
51
|
+
"""Return value of :meth:`Browser.get_histograms`."""
|
|
52
|
+
histograms: List[Histogram]
|
|
53
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
54
|
+
FieldMeta('histograms', 'histograms', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Browser.Histogram')),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass
|
|
59
|
+
class GetHistogramReturn(DataType):
|
|
60
|
+
"""Return value of :meth:`Browser.get_histogram`."""
|
|
61
|
+
histogram: Histogram
|
|
62
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
63
|
+
FieldMeta('histogram', 'histogram', False, 'object', ref='Browser.Histogram'),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass
|
|
68
|
+
class GetWindowBoundsReturn(DataType):
|
|
69
|
+
"""Return value of :meth:`Browser.get_window_bounds`."""
|
|
70
|
+
bounds: Bounds
|
|
71
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
72
|
+
FieldMeta('bounds', 'bounds', False, 'object', ref='Browser.Bounds'),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass
|
|
77
|
+
class GetWindowForTargetReturn(DataType):
|
|
78
|
+
"""Return value of :meth:`Browser.get_window_for_target`."""
|
|
79
|
+
window_id: WindowID
|
|
80
|
+
bounds: Bounds
|
|
81
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
82
|
+
FieldMeta('window_id', 'windowId', False, 'primitive'),
|
|
83
|
+
FieldMeta('bounds', 'bounds', False, 'object', ref='Browser.Bounds'),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class Browser:
|
|
88
|
+
"""Commands of the Browser domain, bound to a target."""
|
|
89
|
+
|
|
90
|
+
def __init__(self, target: Any) -> None:
|
|
91
|
+
self._target = target
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
async def set_permission(self, *, permission: PermissionDescriptor, setting: PermissionSetting, origin: Optional[str] = None, embedded_origin: Optional[str] = None, browser_context_id: Optional[BrowserContextID] = None) -> None:
|
|
95
|
+
"""
|
|
96
|
+
Set permission settings for given embedding and embedded origins.
|
|
97
|
+
:param permission: Descriptor of permission to override.
|
|
98
|
+
:param setting: Setting of the permission.
|
|
99
|
+
:param origin: Embedding origin the permission applies to, all origins if not specified.
|
|
100
|
+
:param embedded_origin: Embedded origin the permission applies to. It is ignored unless the embedding origin is
|
|
101
|
+
present and valid. If the embedding origin is provided but the embedded origin isn't, the
|
|
102
|
+
embedding origin is used as the embedded origin.
|
|
103
|
+
:param browser_context_id: Context to override. When omitted, default browser context is used.
|
|
104
|
+
"""
|
|
105
|
+
_params: Dict[str, Any] = {}
|
|
106
|
+
_params['permission'] = encode(FieldMeta('', '', False, 'object', ref='Browser.PermissionDescriptor'), permission)
|
|
107
|
+
_params['setting'] = encode(FieldMeta('', '', False, 'enum', ref='Browser.PermissionSetting'), setting)
|
|
108
|
+
if origin is not None:
|
|
109
|
+
_params['origin'] = encode(FieldMeta('', '', False, 'primitive'), origin)
|
|
110
|
+
if embedded_origin is not None:
|
|
111
|
+
_params['embeddedOrigin'] = encode(FieldMeta('', '', False, 'primitive'), embedded_origin)
|
|
112
|
+
if browser_context_id is not None:
|
|
113
|
+
_params['browserContextId'] = encode(FieldMeta('', '', False, 'primitive'), browser_context_id)
|
|
114
|
+
_result = await self._target.send('Browser.setPermission', _params)
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
async def grant_permissions(self, *, permissions: List[PermissionType], origin: Optional[str] = None, browser_context_id: Optional[BrowserContextID] = None) -> None:
|
|
118
|
+
"""
|
|
119
|
+
Grant specific permissions to the given origin and reject all others. Deprecated. Use
|
|
120
|
+
setPermission instead.
|
|
121
|
+
|
|
122
|
+
.. deprecated::
|
|
123
|
+
:param permissions:
|
|
124
|
+
:param origin: Origin the permission applies to, all origins if not specified.
|
|
125
|
+
:param browser_context_id: BrowserContext to override permissions. When omitted, default browser context is used.
|
|
126
|
+
"""
|
|
127
|
+
_params: Dict[str, Any] = {}
|
|
128
|
+
_params['permissions'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'enum', ref='Browser.PermissionType')), permissions)
|
|
129
|
+
if origin is not None:
|
|
130
|
+
_params['origin'] = encode(FieldMeta('', '', False, 'primitive'), origin)
|
|
131
|
+
if browser_context_id is not None:
|
|
132
|
+
_params['browserContextId'] = encode(FieldMeta('', '', False, 'primitive'), browser_context_id)
|
|
133
|
+
_result = await self._target.send('Browser.grantPermissions', _params)
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
async def reset_permissions(self, *, browser_context_id: Optional[BrowserContextID] = None) -> None:
|
|
137
|
+
"""
|
|
138
|
+
Reset all permission management for all origins.
|
|
139
|
+
:param browser_context_id: BrowserContext to reset permissions. When omitted, default browser context is used.
|
|
140
|
+
"""
|
|
141
|
+
_params: Dict[str, Any] = {}
|
|
142
|
+
if browser_context_id is not None:
|
|
143
|
+
_params['browserContextId'] = encode(FieldMeta('', '', False, 'primitive'), browser_context_id)
|
|
144
|
+
_result = await self._target.send('Browser.resetPermissions', _params)
|
|
145
|
+
return None
|
|
146
|
+
|
|
147
|
+
async def set_download_behavior(self, *, behavior: Literal['deny', 'allow', 'allowAndName', 'default'], browser_context_id: Optional[BrowserContextID] = None, download_path: Optional[str] = None, events_enabled: Optional[bool] = None) -> None:
|
|
148
|
+
"""
|
|
149
|
+
Set the behavior when downloading a file.
|
|
150
|
+
:param behavior: Whether to allow all or deny all download requests, or use default Chrome behavior if
|
|
151
|
+
available (otherwise deny). |allowAndName| allows download and names files according to
|
|
152
|
+
their download guids.
|
|
153
|
+
:param browser_context_id: BrowserContext to set download behavior. When omitted, default browser context is used.
|
|
154
|
+
:param download_path: The default path to save downloaded files to. This is required if behavior is set to 'allow'
|
|
155
|
+
or 'allowAndName'.
|
|
156
|
+
:param events_enabled: Whether to emit download events (defaults to false).
|
|
157
|
+
"""
|
|
158
|
+
_params: Dict[str, Any] = {}
|
|
159
|
+
_params['behavior'] = encode(FieldMeta('', '', False, 'primitive'), behavior)
|
|
160
|
+
if browser_context_id is not None:
|
|
161
|
+
_params['browserContextId'] = encode(FieldMeta('', '', False, 'primitive'), browser_context_id)
|
|
162
|
+
if download_path is not None:
|
|
163
|
+
_params['downloadPath'] = encode(FieldMeta('', '', False, 'primitive'), download_path)
|
|
164
|
+
if events_enabled is not None:
|
|
165
|
+
_params['eventsEnabled'] = encode(FieldMeta('', '', False, 'primitive'), events_enabled)
|
|
166
|
+
_result = await self._target.send('Browser.setDownloadBehavior', _params)
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
async def cancel_download(self, *, guid: str, browser_context_id: Optional[BrowserContextID] = None) -> None:
|
|
170
|
+
"""
|
|
171
|
+
Cancel a download if in progress
|
|
172
|
+
:param guid: Global unique identifier of the download.
|
|
173
|
+
:param browser_context_id: BrowserContext to perform the action in. When omitted, default browser context is used.
|
|
174
|
+
"""
|
|
175
|
+
_params: Dict[str, Any] = {}
|
|
176
|
+
_params['guid'] = encode(FieldMeta('', '', False, 'primitive'), guid)
|
|
177
|
+
if browser_context_id is not None:
|
|
178
|
+
_params['browserContextId'] = encode(FieldMeta('', '', False, 'primitive'), browser_context_id)
|
|
179
|
+
_result = await self._target.send('Browser.cancelDownload', _params)
|
|
180
|
+
return None
|
|
181
|
+
|
|
182
|
+
async def close(self) -> None:
|
|
183
|
+
"""Close browser gracefully."""
|
|
184
|
+
_params: Dict[str, Any] = {}
|
|
185
|
+
_result = await self._target.send('Browser.close', _params)
|
|
186
|
+
return None
|
|
187
|
+
|
|
188
|
+
async def crash(self) -> None:
|
|
189
|
+
"""Crashes browser on the main thread."""
|
|
190
|
+
_params: Dict[str, Any] = {}
|
|
191
|
+
_result = await self._target.send('Browser.crash', _params)
|
|
192
|
+
return None
|
|
193
|
+
|
|
194
|
+
async def crash_gpu_process(self) -> None:
|
|
195
|
+
"""Crashes GPU process."""
|
|
196
|
+
_params: Dict[str, Any] = {}
|
|
197
|
+
_result = await self._target.send('Browser.crashGpuProcess', _params)
|
|
198
|
+
return None
|
|
199
|
+
|
|
200
|
+
async def get_version(self) -> GetVersionReturn:
|
|
201
|
+
"""Returns version information."""
|
|
202
|
+
_params: Dict[str, Any] = {}
|
|
203
|
+
_result = await self._target.send('Browser.getVersion', _params)
|
|
204
|
+
return GetVersionReturn.from_json(_result)
|
|
205
|
+
|
|
206
|
+
async def get_browser_command_line(self) -> GetBrowserCommandLineReturn:
|
|
207
|
+
"""
|
|
208
|
+
Returns the command line switches for the browser process if, and only if
|
|
209
|
+
--enable-automation is on the commandline.
|
|
210
|
+
"""
|
|
211
|
+
_params: Dict[str, Any] = {}
|
|
212
|
+
_result = await self._target.send('Browser.getBrowserCommandLine', _params)
|
|
213
|
+
return GetBrowserCommandLineReturn.from_json(_result)
|
|
214
|
+
|
|
215
|
+
async def get_histograms(self, *, query: Optional[str] = None, delta: Optional[bool] = None) -> GetHistogramsReturn:
|
|
216
|
+
"""
|
|
217
|
+
Get Chrome histograms.
|
|
218
|
+
:param query: Requested substring in name. Only histograms which have query as a
|
|
219
|
+
substring in their name are extracted. An empty or absent query returns
|
|
220
|
+
all histograms.
|
|
221
|
+
:param delta: If true, retrieve delta since last delta call.
|
|
222
|
+
"""
|
|
223
|
+
_params: Dict[str, Any] = {}
|
|
224
|
+
if query is not None:
|
|
225
|
+
_params['query'] = encode(FieldMeta('', '', False, 'primitive'), query)
|
|
226
|
+
if delta is not None:
|
|
227
|
+
_params['delta'] = encode(FieldMeta('', '', False, 'primitive'), delta)
|
|
228
|
+
_result = await self._target.send('Browser.getHistograms', _params)
|
|
229
|
+
return GetHistogramsReturn.from_json(_result)
|
|
230
|
+
|
|
231
|
+
async def get_histogram(self, *, name: str, delta: Optional[bool] = None) -> GetHistogramReturn:
|
|
232
|
+
"""
|
|
233
|
+
Get a Chrome histogram by name.
|
|
234
|
+
:param name: Requested histogram name.
|
|
235
|
+
:param delta: If true, retrieve delta since last delta call.
|
|
236
|
+
"""
|
|
237
|
+
_params: Dict[str, Any] = {}
|
|
238
|
+
_params['name'] = encode(FieldMeta('', '', False, 'primitive'), name)
|
|
239
|
+
if delta is not None:
|
|
240
|
+
_params['delta'] = encode(FieldMeta('', '', False, 'primitive'), delta)
|
|
241
|
+
_result = await self._target.send('Browser.getHistogram', _params)
|
|
242
|
+
return GetHistogramReturn.from_json(_result)
|
|
243
|
+
|
|
244
|
+
async def get_window_bounds(self, *, window_id: WindowID) -> GetWindowBoundsReturn:
|
|
245
|
+
"""
|
|
246
|
+
Get position and size of the browser window.
|
|
247
|
+
:param window_id: Browser window id.
|
|
248
|
+
"""
|
|
249
|
+
_params: Dict[str, Any] = {}
|
|
250
|
+
_params['windowId'] = encode(FieldMeta('', '', False, 'primitive'), window_id)
|
|
251
|
+
_result = await self._target.send('Browser.getWindowBounds', _params)
|
|
252
|
+
return GetWindowBoundsReturn.from_json(_result)
|
|
253
|
+
|
|
254
|
+
async def get_window_for_target(self, *, target_id: Optional[Target_TargetID] = None) -> GetWindowForTargetReturn:
|
|
255
|
+
"""
|
|
256
|
+
Get the browser window that contains the devtools target.
|
|
257
|
+
:param target_id: Devtools agent host id. If called as a part of the session, associated targetId is used.
|
|
258
|
+
"""
|
|
259
|
+
_params: Dict[str, Any] = {}
|
|
260
|
+
if target_id is not None:
|
|
261
|
+
_params['targetId'] = encode(FieldMeta('', '', False, 'primitive'), target_id)
|
|
262
|
+
_result = await self._target.send('Browser.getWindowForTarget', _params)
|
|
263
|
+
return GetWindowForTargetReturn.from_json(_result)
|
|
264
|
+
|
|
265
|
+
async def set_window_bounds(self, *, window_id: WindowID, bounds: Bounds) -> None:
|
|
266
|
+
"""
|
|
267
|
+
Set position and/or size of the browser window.
|
|
268
|
+
:param window_id: Browser window id.
|
|
269
|
+
:param bounds: New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
|
|
270
|
+
with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
|
|
271
|
+
"""
|
|
272
|
+
_params: Dict[str, Any] = {}
|
|
273
|
+
_params['windowId'] = encode(FieldMeta('', '', False, 'primitive'), window_id)
|
|
274
|
+
_params['bounds'] = encode(FieldMeta('', '', False, 'object', ref='Browser.Bounds'), bounds)
|
|
275
|
+
_result = await self._target.send('Browser.setWindowBounds', _params)
|
|
276
|
+
return None
|
|
277
|
+
|
|
278
|
+
async def set_contents_size(self, *, window_id: WindowID, width: Optional[int] = None, height: Optional[int] = None) -> None:
|
|
279
|
+
"""
|
|
280
|
+
Set size of the browser contents resizing browser window as necessary.
|
|
281
|
+
:param window_id: Browser window id.
|
|
282
|
+
:param width: The window contents width in DIP. Assumes current width if omitted.
|
|
283
|
+
Must be specified if 'height' is omitted.
|
|
284
|
+
:param height: The window contents height in DIP. Assumes current height if omitted.
|
|
285
|
+
Must be specified if 'width' is omitted.
|
|
286
|
+
"""
|
|
287
|
+
_params: Dict[str, Any] = {}
|
|
288
|
+
_params['windowId'] = encode(FieldMeta('', '', False, 'primitive'), window_id)
|
|
289
|
+
if width is not None:
|
|
290
|
+
_params['width'] = encode(FieldMeta('', '', False, 'primitive'), width)
|
|
291
|
+
if height is not None:
|
|
292
|
+
_params['height'] = encode(FieldMeta('', '', False, 'primitive'), height)
|
|
293
|
+
_result = await self._target.send('Browser.setContentsSize', _params)
|
|
294
|
+
return None
|
|
295
|
+
|
|
296
|
+
async def set_dock_tile(self, *, badge_label: Optional[str] = None, image: Optional[str] = None) -> None:
|
|
297
|
+
"""
|
|
298
|
+
Set dock tile details, platform-specific.
|
|
299
|
+
:param badge_label:
|
|
300
|
+
:param image: Png encoded image. (Encoded as a base64 string when passed over JSON)
|
|
301
|
+
"""
|
|
302
|
+
_params: Dict[str, Any] = {}
|
|
303
|
+
if badge_label is not None:
|
|
304
|
+
_params['badgeLabel'] = encode(FieldMeta('', '', False, 'primitive'), badge_label)
|
|
305
|
+
if image is not None:
|
|
306
|
+
_params['image'] = encode(FieldMeta('', '', False, 'primitive'), image)
|
|
307
|
+
_result = await self._target.send('Browser.setDockTile', _params)
|
|
308
|
+
return None
|
|
309
|
+
|
|
310
|
+
async def execute_browser_command(self, *, command_id: BrowserCommandId) -> None:
|
|
311
|
+
"""
|
|
312
|
+
Invoke custom browser commands used by telemetry.
|
|
313
|
+
:param command_id:
|
|
314
|
+
"""
|
|
315
|
+
_params: Dict[str, Any] = {}
|
|
316
|
+
_params['commandId'] = encode(FieldMeta('', '', False, 'enum', ref='Browser.BrowserCommandId'), command_id)
|
|
317
|
+
_result = await self._target.send('Browser.executeBrowserCommand', _params)
|
|
318
|
+
return None
|
|
319
|
+
|
|
320
|
+
async def add_privacy_sandbox_enrollment_override(self, *, url: str) -> None:
|
|
321
|
+
"""
|
|
322
|
+
Allows a site to use privacy sandbox features that require enrollment
|
|
323
|
+
without the site actually being enrolled. Only supported on page targets.
|
|
324
|
+
:param url:
|
|
325
|
+
"""
|
|
326
|
+
_params: Dict[str, Any] = {}
|
|
327
|
+
_params['url'] = encode(FieldMeta('', '', False, 'primitive'), url)
|
|
328
|
+
_result = await self._target.send('Browser.addPrivacySandboxEnrollmentOverride', _params)
|
|
329
|
+
return None
|
|
330
|
+
|
|
331
|
+
async def add_privacy_sandbox_coordinator_key_config(self, *, api: PrivacySandboxAPI, coordinator_origin: str, key_config: str, browser_context_id: Optional[BrowserContextID] = None) -> None:
|
|
332
|
+
"""
|
|
333
|
+
Configures encryption keys used with a given privacy sandbox API to talk
|
|
334
|
+
to a trusted coordinator. Since this is intended for test automation only,
|
|
335
|
+
coordinatorOrigin must be a .test domain. No existing coordinator
|
|
336
|
+
configuration for the origin may exist.
|
|
337
|
+
:param api:
|
|
338
|
+
:param coordinator_origin:
|
|
339
|
+
:param key_config:
|
|
340
|
+
:param browser_context_id: BrowserContext to perform the action in. When omitted, default browser
|
|
341
|
+
context is used.
|
|
342
|
+
"""
|
|
343
|
+
_params: Dict[str, Any] = {}
|
|
344
|
+
_params['api'] = encode(FieldMeta('', '', False, 'enum', ref='Browser.PrivacySandboxAPI'), api)
|
|
345
|
+
_params['coordinatorOrigin'] = encode(FieldMeta('', '', False, 'primitive'), coordinator_origin)
|
|
346
|
+
_params['keyConfig'] = encode(FieldMeta('', '', False, 'primitive'), key_config)
|
|
347
|
+
if browser_context_id is not None:
|
|
348
|
+
_params['browserContextId'] = encode(FieldMeta('', '', False, 'primitive'), browser_context_id)
|
|
349
|
+
_result = await self._target.send('Browser.addPrivacySandboxCoordinatorKeyConfig', _params)
|
|
350
|
+
return None
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""Custom types and enums for the Browser domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from ..mixins.datatype import DataType, FieldMeta, register
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type BrowserContextID = str
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
type WindowID = int
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@register("Browser.WindowState")
|
|
18
|
+
class WindowState(str, Enum):
|
|
19
|
+
"""The state of the browser window."""
|
|
20
|
+
NORMAL = 'normal'
|
|
21
|
+
MINIMIZED = 'minimized'
|
|
22
|
+
MAXIMIZED = 'maximized'
|
|
23
|
+
FULLSCREEN = 'fullscreen'
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@register("Browser.Bounds")
|
|
27
|
+
@dataclass
|
|
28
|
+
class Bounds(DataType):
|
|
29
|
+
"""Browser window bounds information"""
|
|
30
|
+
left: Optional[int] = None
|
|
31
|
+
top: Optional[int] = None
|
|
32
|
+
width: Optional[int] = None
|
|
33
|
+
height: Optional[int] = None
|
|
34
|
+
window_state: Optional[WindowState] = None
|
|
35
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
36
|
+
FieldMeta('left', 'left', True, 'primitive'),
|
|
37
|
+
FieldMeta('top', 'top', True, 'primitive'),
|
|
38
|
+
FieldMeta('width', 'width', True, 'primitive'),
|
|
39
|
+
FieldMeta('height', 'height', True, 'primitive'),
|
|
40
|
+
FieldMeta('window_state', 'windowState', True, 'enum', ref='Browser.WindowState'),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@register("Browser.PermissionType")
|
|
45
|
+
class PermissionType(str, Enum):
|
|
46
|
+
AR = 'ar'
|
|
47
|
+
AUDIOCAPTURE = 'audioCapture'
|
|
48
|
+
AUTOMATICFULLSCREEN = 'automaticFullscreen'
|
|
49
|
+
BACKGROUNDFETCH = 'backgroundFetch'
|
|
50
|
+
BACKGROUNDSYNC = 'backgroundSync'
|
|
51
|
+
CAMERAPANTILTZOOM = 'cameraPanTiltZoom'
|
|
52
|
+
CAPTUREDSURFACECONTROL = 'capturedSurfaceControl'
|
|
53
|
+
CLIPBOARDREADWRITE = 'clipboardReadWrite'
|
|
54
|
+
CLIPBOARDSANITIZEDWRITE = 'clipboardSanitizedWrite'
|
|
55
|
+
DISPLAYCAPTURE = 'displayCapture'
|
|
56
|
+
DURABLESTORAGE = 'durableStorage'
|
|
57
|
+
GEOLOCATION = 'geolocation'
|
|
58
|
+
HANDTRACKING = 'handTracking'
|
|
59
|
+
IDLEDETECTION = 'idleDetection'
|
|
60
|
+
KEYBOARDLOCK = 'keyboardLock'
|
|
61
|
+
LOCALFONTS = 'localFonts'
|
|
62
|
+
LOCALNETWORKACCESS = 'localNetworkAccess'
|
|
63
|
+
MIDI = 'midi'
|
|
64
|
+
MIDISYSEX = 'midiSysex'
|
|
65
|
+
NFC = 'nfc'
|
|
66
|
+
NOTIFICATIONS = 'notifications'
|
|
67
|
+
PAYMENTHANDLER = 'paymentHandler'
|
|
68
|
+
PERIODICBACKGROUNDSYNC = 'periodicBackgroundSync'
|
|
69
|
+
POINTERLOCK = 'pointerLock'
|
|
70
|
+
PROTECTEDMEDIAIDENTIFIER = 'protectedMediaIdentifier'
|
|
71
|
+
SENSORS = 'sensors'
|
|
72
|
+
SMARTCARD = 'smartCard'
|
|
73
|
+
SPEAKERSELECTION = 'speakerSelection'
|
|
74
|
+
STORAGEACCESS = 'storageAccess'
|
|
75
|
+
TOPLEVELSTORAGEACCESS = 'topLevelStorageAccess'
|
|
76
|
+
VIDEOCAPTURE = 'videoCapture'
|
|
77
|
+
VR = 'vr'
|
|
78
|
+
WAKELOCKSCREEN = 'wakeLockScreen'
|
|
79
|
+
WAKELOCKSYSTEM = 'wakeLockSystem'
|
|
80
|
+
WEBAPPINSTALLATION = 'webAppInstallation'
|
|
81
|
+
WEBPRINTING = 'webPrinting'
|
|
82
|
+
WINDOWMANAGEMENT = 'windowManagement'
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@register("Browser.PermissionSetting")
|
|
86
|
+
class PermissionSetting(str, Enum):
|
|
87
|
+
GRANTED = 'granted'
|
|
88
|
+
DENIED = 'denied'
|
|
89
|
+
PROMPT = 'prompt'
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@register("Browser.PermissionDescriptor")
|
|
93
|
+
@dataclass
|
|
94
|
+
class PermissionDescriptor(DataType):
|
|
95
|
+
"""
|
|
96
|
+
Definition of PermissionDescriptor defined in the Permissions API:
|
|
97
|
+
https://w3c.github.io/permissions/#dom-permissiondescriptor.
|
|
98
|
+
"""
|
|
99
|
+
name: str
|
|
100
|
+
sysex: Optional[bool] = None
|
|
101
|
+
user_visible_only: Optional[bool] = None
|
|
102
|
+
allow_without_sanitization: Optional[bool] = None
|
|
103
|
+
allow_without_gesture: Optional[bool] = None
|
|
104
|
+
pan_tilt_zoom: Optional[bool] = None
|
|
105
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
106
|
+
FieldMeta('name', 'name', False, 'primitive'),
|
|
107
|
+
FieldMeta('sysex', 'sysex', True, 'primitive'),
|
|
108
|
+
FieldMeta('user_visible_only', 'userVisibleOnly', True, 'primitive'),
|
|
109
|
+
FieldMeta('allow_without_sanitization', 'allowWithoutSanitization', True, 'primitive'),
|
|
110
|
+
FieldMeta('allow_without_gesture', 'allowWithoutGesture', True, 'primitive'),
|
|
111
|
+
FieldMeta('pan_tilt_zoom', 'panTiltZoom', True, 'primitive'),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@register("Browser.BrowserCommandId")
|
|
116
|
+
class BrowserCommandId(str, Enum):
|
|
117
|
+
"""Browser command ids used by executeBrowserCommand."""
|
|
118
|
+
OPENTABSEARCH = 'openTabSearch'
|
|
119
|
+
CLOSETABSEARCH = 'closeTabSearch'
|
|
120
|
+
OPENGLIC = 'openGlic'
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@register("Browser.Bucket")
|
|
124
|
+
@dataclass
|
|
125
|
+
class Bucket(DataType):
|
|
126
|
+
"""Chrome histogram bucket."""
|
|
127
|
+
low: int
|
|
128
|
+
high: int
|
|
129
|
+
count: int
|
|
130
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
131
|
+
FieldMeta('low', 'low', False, 'primitive'),
|
|
132
|
+
FieldMeta('high', 'high', False, 'primitive'),
|
|
133
|
+
FieldMeta('count', 'count', False, 'primitive'),
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@register("Browser.Histogram")
|
|
138
|
+
@dataclass
|
|
139
|
+
class Histogram(DataType):
|
|
140
|
+
"""Chrome histogram."""
|
|
141
|
+
name: str
|
|
142
|
+
sum: int
|
|
143
|
+
count: int
|
|
144
|
+
buckets: List[Bucket]
|
|
145
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
146
|
+
FieldMeta('name', 'name', False, 'primitive'),
|
|
147
|
+
FieldMeta('sum', 'sum', False, 'primitive'),
|
|
148
|
+
FieldMeta('count', 'count', False, 'primitive'),
|
|
149
|
+
FieldMeta('buckets', 'buckets', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Browser.Bucket')),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@register("Browser.PrivacySandboxAPI")
|
|
154
|
+
class PrivacySandboxAPI(str, Enum):
|
|
155
|
+
BIDDINGANDAUCTIONSERVICES = 'BiddingAndAuctionServices'
|
|
156
|
+
TRUSTEDKEYVALUE = 'TrustedKeyValue'
|
|
157
|
+
|
|
158
|
+
__all__ = ["Bounds", "BrowserCommandId", "BrowserContextID", "Bucket", "Histogram", "PermissionDescriptor", "PermissionSetting", "PermissionType", "PrivacySandboxAPI", "WindowID", "WindowState"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The CacheStorage CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``CacheStorage`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``CacheStorage.SomeEvent`` /
|
|
5
|
+
``CacheStorage.SomeType``); commands run on a target via ``page.cdp.CacheStorage``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import CacheStorage
|
|
9
|
+
from .events import * # noqa: F401,F403 -- expose events on the namespace
|
|
10
|
+
from .types import * # noqa: F401,F403 -- expose types on the namespace
|
|
11
|
+
|
|
12
|
+
#: Protocol domain name (used by features that declare ``domains=(CacheStorage,)``).
|
|
13
|
+
DOMAIN = "CacheStorage"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "CacheStorage", "DOMAIN"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Events for the CacheStorage domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import FieldMeta
|
|
8
|
+
from ..mixins.event import Event, register_event
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# This domain defines no events.
|
|
12
|
+
|
|
13
|
+
__all__ = []
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""Commands for the CacheStorage domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import DataType, FieldMeta, encode
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import (
|
|
11
|
+
Cache,
|
|
12
|
+
CacheId,
|
|
13
|
+
CachedResponse,
|
|
14
|
+
DataEntry,
|
|
15
|
+
Header,
|
|
16
|
+
)
|
|
17
|
+
from ..storage.types import StorageBucket as Storage_StorageBucket
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class RequestCacheNamesReturn(DataType):
|
|
21
|
+
"""Return value of :meth:`CacheStorage.request_cache_names`."""
|
|
22
|
+
caches: List[Cache]
|
|
23
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
24
|
+
FieldMeta('caches', 'caches', False, 'array', inner=FieldMeta('', '', False, 'object', ref='CacheStorage.Cache')),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class RequestCachedResponseReturn(DataType):
|
|
30
|
+
"""Return value of :meth:`CacheStorage.request_cached_response`."""
|
|
31
|
+
response: CachedResponse
|
|
32
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
33
|
+
FieldMeta('response', 'response', False, 'object', ref='CacheStorage.CachedResponse'),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class RequestEntriesReturn(DataType):
|
|
39
|
+
"""Return value of :meth:`CacheStorage.request_entries`."""
|
|
40
|
+
cache_data_entries: List[DataEntry]
|
|
41
|
+
return_count: float
|
|
42
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
43
|
+
FieldMeta('cache_data_entries', 'cacheDataEntries', False, 'array', inner=FieldMeta('', '', False, 'object', ref='CacheStorage.DataEntry')),
|
|
44
|
+
FieldMeta('return_count', 'returnCount', False, 'primitive'),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class CacheStorage:
|
|
49
|
+
"""Commands of the CacheStorage domain, bound to a target."""
|
|
50
|
+
|
|
51
|
+
def __init__(self, target: Any) -> None:
|
|
52
|
+
self._target = target
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
async def delete_cache(self, *, cache_id: CacheId) -> None:
|
|
56
|
+
"""
|
|
57
|
+
Deletes a cache.
|
|
58
|
+
:param cache_id: Id of cache for deletion.
|
|
59
|
+
"""
|
|
60
|
+
_params: Dict[str, Any] = {}
|
|
61
|
+
_params['cacheId'] = encode(FieldMeta('', '', False, 'primitive'), cache_id)
|
|
62
|
+
_result = await self._target.send('CacheStorage.deleteCache', _params)
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
async def delete_entry(self, *, cache_id: CacheId, request: str) -> None:
|
|
66
|
+
"""
|
|
67
|
+
Deletes a cache entry.
|
|
68
|
+
:param cache_id: Id of cache where the entry will be deleted.
|
|
69
|
+
:param request: URL spec of the request.
|
|
70
|
+
"""
|
|
71
|
+
_params: Dict[str, Any] = {}
|
|
72
|
+
_params['cacheId'] = encode(FieldMeta('', '', False, 'primitive'), cache_id)
|
|
73
|
+
_params['request'] = encode(FieldMeta('', '', False, 'primitive'), request)
|
|
74
|
+
_result = await self._target.send('CacheStorage.deleteEntry', _params)
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
async def request_cache_names(self, *, security_origin: Optional[str] = None, storage_key: Optional[str] = None, storage_bucket: Optional[Storage_StorageBucket] = None) -> RequestCacheNamesReturn:
|
|
78
|
+
"""
|
|
79
|
+
Requests cache names.
|
|
80
|
+
:param security_origin: At least and at most one of securityOrigin, storageKey, storageBucket must be specified.
|
|
81
|
+
Security origin.
|
|
82
|
+
:param storage_key: Storage key.
|
|
83
|
+
:param storage_bucket: Storage bucket. If not specified, it uses the default bucket.
|
|
84
|
+
"""
|
|
85
|
+
_params: Dict[str, Any] = {}
|
|
86
|
+
if security_origin is not None:
|
|
87
|
+
_params['securityOrigin'] = encode(FieldMeta('', '', False, 'primitive'), security_origin)
|
|
88
|
+
if storage_key is not None:
|
|
89
|
+
_params['storageKey'] = encode(FieldMeta('', '', False, 'primitive'), storage_key)
|
|
90
|
+
if storage_bucket is not None:
|
|
91
|
+
_params['storageBucket'] = encode(FieldMeta('', '', False, 'object', ref='Storage.StorageBucket'), storage_bucket)
|
|
92
|
+
_result = await self._target.send('CacheStorage.requestCacheNames', _params)
|
|
93
|
+
return RequestCacheNamesReturn.from_json(_result)
|
|
94
|
+
|
|
95
|
+
async def request_cached_response(self, *, cache_id: CacheId, request_url: str, request_headers: List[Header]) -> RequestCachedResponseReturn:
|
|
96
|
+
"""
|
|
97
|
+
Fetches cache entry.
|
|
98
|
+
:param cache_id: Id of cache that contains the entry.
|
|
99
|
+
:param request_url: URL spec of the request.
|
|
100
|
+
:param request_headers: headers of the request.
|
|
101
|
+
"""
|
|
102
|
+
_params: Dict[str, Any] = {}
|
|
103
|
+
_params['cacheId'] = encode(FieldMeta('', '', False, 'primitive'), cache_id)
|
|
104
|
+
_params['requestURL'] = encode(FieldMeta('', '', False, 'primitive'), request_url)
|
|
105
|
+
_params['requestHeaders'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='CacheStorage.Header')), request_headers)
|
|
106
|
+
_result = await self._target.send('CacheStorage.requestCachedResponse', _params)
|
|
107
|
+
return RequestCachedResponseReturn.from_json(_result)
|
|
108
|
+
|
|
109
|
+
async def request_entries(self, *, cache_id: CacheId, skip_count: Optional[int] = None, page_size: Optional[int] = None, path_filter: Optional[str] = None) -> RequestEntriesReturn:
|
|
110
|
+
"""
|
|
111
|
+
Requests data from cache.
|
|
112
|
+
:param cache_id: ID of cache to get entries from.
|
|
113
|
+
:param skip_count: Number of records to skip.
|
|
114
|
+
:param page_size: Number of records to fetch.
|
|
115
|
+
:param path_filter: If present, only return the entries containing this substring in the path
|
|
116
|
+
"""
|
|
117
|
+
_params: Dict[str, Any] = {}
|
|
118
|
+
_params['cacheId'] = encode(FieldMeta('', '', False, 'primitive'), cache_id)
|
|
119
|
+
if skip_count is not None:
|
|
120
|
+
_params['skipCount'] = encode(FieldMeta('', '', False, 'primitive'), skip_count)
|
|
121
|
+
if page_size is not None:
|
|
122
|
+
_params['pageSize'] = encode(FieldMeta('', '', False, 'primitive'), page_size)
|
|
123
|
+
if path_filter is not None:
|
|
124
|
+
_params['pathFilter'] = encode(FieldMeta('', '', False, 'primitive'), path_filter)
|
|
125
|
+
_result = await self._target.send('CacheStorage.requestEntries', _params)
|
|
126
|
+
return RequestEntriesReturn.from_json(_result)
|