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.
Files changed (242) hide show
  1. parsek_cdp/__init__.py +55 -0
  2. parsek_cdp/_logging.py +49 -0
  3. parsek_cdp/cdp/__init__.py +247 -0
  4. parsek_cdp/cdp/accessibility/__init__.py +15 -0
  5. parsek_cdp/cdp/accessibility/events.py +35 -0
  6. parsek_cdp/cdp/accessibility/functions.py +202 -0
  7. parsek_cdp/cdp/accessibility/types.py +235 -0
  8. parsek_cdp/cdp/animation/__init__.py +15 -0
  9. parsek_cdp/cdp/animation/events.py +52 -0
  10. parsek_cdp/cdp/animation/functions.py +140 -0
  11. parsek_cdp/cdp/animation/types.py +113 -0
  12. parsek_cdp/cdp/audits/__init__.py +15 -0
  13. parsek_cdp/cdp/audits/events.py +21 -0
  14. parsek_cdp/cdp/audits/functions.py +95 -0
  15. parsek_cdp/cdp/audits/types.py +1051 -0
  16. parsek_cdp/cdp/autofill/__init__.py +15 -0
  17. parsek_cdp/cdp/autofill/events.py +27 -0
  18. parsek_cdp/cdp/autofill/functions.py +64 -0
  19. parsek_cdp/cdp/autofill/types.py +108 -0
  20. parsek_cdp/cdp/backgroundservice/__init__.py +15 -0
  21. parsek_cdp/cdp/backgroundservice/events.py +40 -0
  22. parsek_cdp/cdp/backgroundservice/functions.py +59 -0
  23. parsek_cdp/cdp/backgroundservice/types.py +63 -0
  24. parsek_cdp/cdp/bluetoothemulation/__init__.py +15 -0
  25. parsek_cdp/cdp/bluetoothemulation/events.py +70 -0
  26. parsek_cdp/cdp/bluetoothemulation/functions.py +247 -0
  27. parsek_cdp/cdp/bluetoothemulation/types.py +120 -0
  28. parsek_cdp/cdp/browser/__init__.py +15 -0
  29. parsek_cdp/cdp/browser/events.py +46 -0
  30. parsek_cdp/cdp/browser/functions.py +350 -0
  31. parsek_cdp/cdp/browser/types.py +158 -0
  32. parsek_cdp/cdp/cachestorage/__init__.py +15 -0
  33. parsek_cdp/cdp/cachestorage/events.py +13 -0
  34. parsek_cdp/cdp/cachestorage/functions.py +126 -0
  35. parsek_cdp/cdp/cachestorage/types.py +89 -0
  36. parsek_cdp/cdp/cast/__init__.py +15 -0
  37. parsek_cdp/cdp/cast/events.py +38 -0
  38. parsek_cdp/cdp/cast/functions.py +77 -0
  39. parsek_cdp/cdp/cast/types.py +23 -0
  40. parsek_cdp/cdp/console/__init__.py +15 -0
  41. parsek_cdp/cdp/console/events.py +22 -0
  42. parsek_cdp/cdp/console/functions.py +36 -0
  43. parsek_cdp/cdp/console/types.py +30 -0
  44. parsek_cdp/cdp/css/__init__.py +15 -0
  45. parsek_cdp/cdp/css/events.py +79 -0
  46. parsek_cdp/cdp/css/functions.py +788 -0
  47. parsek_cdp/cdp/css/types.py +742 -0
  48. parsek_cdp/cdp/debugger/__init__.py +15 -0
  49. parsek_cdp/cdp/debugger/events.py +164 -0
  50. parsek_cdp/cdp/debugger/functions.py +663 -0
  51. parsek_cdp/cdp/debugger/types.py +171 -0
  52. parsek_cdp/cdp/deviceaccess/__init__.py +15 -0
  53. parsek_cdp/cdp/deviceaccess/events.py +30 -0
  54. parsek_cdp/cdp/deviceaccess/functions.py +54 -0
  55. parsek_cdp/cdp/deviceaccess/types.py +28 -0
  56. parsek_cdp/cdp/deviceorientation/__init__.py +15 -0
  57. parsek_cdp/cdp/deviceorientation/events.py +13 -0
  58. parsek_cdp/cdp/deviceorientation/functions.py +35 -0
  59. parsek_cdp/cdp/deviceorientation/types.py +10 -0
  60. parsek_cdp/cdp/dom/__init__.py +15 -0
  61. parsek_cdp/cdp/dom/events.py +228 -0
  62. parsek_cdp/cdp/dom/functions.py +1033 -0
  63. parsek_cdp/cdp/dom/types.py +293 -0
  64. parsek_cdp/cdp/domdebugger/__init__.py +15 -0
  65. parsek_cdp/cdp/domdebugger/events.py +13 -0
  66. parsek_cdp/cdp/domdebugger/functions.py +155 -0
  67. parsek_cdp/cdp/domdebugger/types.py +57 -0
  68. parsek_cdp/cdp/domsnapshot/__init__.py +15 -0
  69. parsek_cdp/cdp/domsnapshot/events.py +13 -0
  70. parsek_cdp/cdp/domsnapshot/functions.py +111 -0
  71. parsek_cdp/cdp/domsnapshot/types.py +312 -0
  72. parsek_cdp/cdp/domstorage/__init__.py +15 -0
  73. parsek_cdp/cdp/domstorage/events.py +60 -0
  74. parsek_cdp/cdp/domstorage/functions.py +79 -0
  75. parsek_cdp/cdp/domstorage/types.py +30 -0
  76. parsek_cdp/cdp/emulation/__init__.py +15 -0
  77. parsek_cdp/cdp/emulation/events.py +17 -0
  78. parsek_cdp/cdp/emulation/functions.py +688 -0
  79. parsek_cdp/cdp/emulation/types.py +305 -0
  80. parsek_cdp/cdp/eventbreakpoints/__init__.py +15 -0
  81. parsek_cdp/cdp/eventbreakpoints/events.py +13 -0
  82. parsek_cdp/cdp/eventbreakpoints/functions.py +41 -0
  83. parsek_cdp/cdp/eventbreakpoints/types.py +10 -0
  84. parsek_cdp/cdp/extensions/__init__.py +15 -0
  85. parsek_cdp/cdp/extensions/events.py +13 -0
  86. parsek_cdp/cdp/extensions/functions.py +118 -0
  87. parsek_cdp/cdp/extensions/types.py +19 -0
  88. parsek_cdp/cdp/fedcm/__init__.py +15 -0
  89. parsek_cdp/cdp/fedcm/events.py +45 -0
  90. parsek_cdp/cdp/fedcm/functions.py +93 -0
  91. parsek_cdp/cdp/fedcm/types.py +72 -0
  92. parsek_cdp/cdp/fetch/__init__.py +15 -0
  93. parsek_cdp/cdp/fetch/events.py +82 -0
  94. parsek_cdp/cdp/fetch/functions.py +215 -0
  95. parsek_cdp/cdp/fetch/types.py +81 -0
  96. parsek_cdp/cdp/filesystem/__init__.py +15 -0
  97. parsek_cdp/cdp/filesystem/events.py +13 -0
  98. parsek_cdp/cdp/filesystem/functions.py +36 -0
  99. parsek_cdp/cdp/filesystem/types.py +54 -0
  100. parsek_cdp/cdp/headlessexperimental/__init__.py +15 -0
  101. parsek_cdp/cdp/headlessexperimental/events.py +13 -0
  102. parsek_cdp/cdp/headlessexperimental/functions.py +77 -0
  103. parsek_cdp/cdp/headlessexperimental/types.py +24 -0
  104. parsek_cdp/cdp/heapprofiler/__init__.py +15 -0
  105. parsek_cdp/cdp/heapprofiler/events.py +65 -0
  106. parsek_cdp/cdp/heapprofiler/functions.py +193 -0
  107. parsek_cdp/cdp/heapprofiler/types.py +57 -0
  108. parsek_cdp/cdp/indexeddb/__init__.py +15 -0
  109. parsek_cdp/cdp/indexeddb/events.py +13 -0
  110. parsek_cdp/cdp/indexeddb/functions.py +232 -0
  111. parsek_cdp/cdp/indexeddb/types.py +120 -0
  112. parsek_cdp/cdp/input/__init__.py +15 -0
  113. parsek_cdp/cdp/input/events.py +25 -0
  114. parsek_cdp/cdp/input/functions.py +361 -0
  115. parsek_cdp/cdp/input/types.py +87 -0
  116. parsek_cdp/cdp/inspector/__init__.py +15 -0
  117. parsek_cdp/cdp/inspector/events.py +41 -0
  118. parsek_cdp/cdp/inspector/functions.py +27 -0
  119. parsek_cdp/cdp/inspector/types.py +10 -0
  120. parsek_cdp/cdp/io/__init__.py +15 -0
  121. parsek_cdp/cdp/io/events.py +13 -0
  122. parsek_cdp/cdp/io/functions.py +77 -0
  123. parsek_cdp/cdp/io/types.py +13 -0
  124. parsek_cdp/cdp/layertree/__init__.py +15 -0
  125. parsek_cdp/cdp/layertree/events.py +36 -0
  126. parsek_cdp/cdp/layertree/functions.py +178 -0
  127. parsek_cdp/cdp/layertree/types.py +104 -0
  128. parsek_cdp/cdp/log/__init__.py +15 -0
  129. parsek_cdp/cdp/log/events.py +22 -0
  130. parsek_cdp/cdp/log/functions.py +54 -0
  131. parsek_cdp/cdp/log/types.py +57 -0
  132. parsek_cdp/cdp/media/__init__.py +15 -0
  133. parsek_cdp/cdp/media/events.py +87 -0
  134. parsek_cdp/cdp/media/functions.py +27 -0
  135. parsek_cdp/cdp/media/types.py +101 -0
  136. parsek_cdp/cdp/memory/__init__.py +15 -0
  137. parsek_cdp/cdp/memory/events.py +13 -0
  138. parsek_cdp/cdp/memory/functions.py +164 -0
  139. parsek_cdp/cdp/memory/types.py +71 -0
  140. parsek_cdp/cdp/mixins/__init__.py +21 -0
  141. parsek_cdp/cdp/mixins/datatype.py +123 -0
  142. parsek_cdp/cdp/mixins/event.py +78 -0
  143. parsek_cdp/cdp/mixins/namespace.py +31 -0
  144. parsek_cdp/cdp/network/__init__.py +15 -0
  145. parsek_cdp/cdp/network/events.py +726 -0
  146. parsek_cdp/cdp/network/functions.py +734 -0
  147. parsek_cdp/cdp/network/types.py +1247 -0
  148. parsek_cdp/cdp/overlay/__init__.py +15 -0
  149. parsek_cdp/cdp/overlay/events.py +54 -0
  150. parsek_cdp/cdp/overlay/functions.py +407 -0
  151. parsek_cdp/cdp/overlay/types.py +328 -0
  152. parsek_cdp/cdp/page/__init__.py +15 -0
  153. parsek_cdp/cdp/page/events.py +416 -0
  154. parsek_cdp/cdp/page/functions.py +1081 -0
  155. parsek_cdp/cdp/page/types.py +1088 -0
  156. parsek_cdp/cdp/performance/__init__.py +15 -0
  157. parsek_cdp/cdp/performance/events.py +24 -0
  158. parsek_cdp/cdp/performance/functions.py +63 -0
  159. parsek_cdp/cdp/performance/types.py +22 -0
  160. parsek_cdp/cdp/performancetimeline/__init__.py +15 -0
  161. parsek_cdp/cdp/performancetimeline/events.py +22 -0
  162. parsek_cdp/cdp/performancetimeline/functions.py +30 -0
  163. parsek_cdp/cdp/performancetimeline/types.py +85 -0
  164. parsek_cdp/cdp/preload/__init__.py +15 -0
  165. parsek_cdp/cdp/preload/events.py +116 -0
  166. parsek_cdp/cdp/preload/functions.py +25 -0
  167. parsek_cdp/cdp/preload/types.py +267 -0
  168. parsek_cdp/cdp/profiler/__init__.py +15 -0
  169. parsek_cdp/cdp/profiler/events.py +64 -0
  170. parsek_cdp/cdp/profiler/functions.py +134 -0
  171. parsek_cdp/cdp/profiler/types.py +105 -0
  172. parsek_cdp/cdp/pwa/__init__.py +15 -0
  173. parsek_cdp/cdp/pwa/events.py +13 -0
  174. parsek_cdp/cdp/pwa/functions.py +196 -0
  175. parsek_cdp/cdp/pwa/types.py +45 -0
  176. parsek_cdp/cdp/runtime/__init__.py +15 -0
  177. parsek_cdp/cdp/runtime/events.py +123 -0
  178. parsek_cdp/cdp/runtime/functions.py +552 -0
  179. parsek_cdp/cdp/runtime/types.py +319 -0
  180. parsek_cdp/cdp/schema/__init__.py +15 -0
  181. parsek_cdp/cdp/schema/events.py +13 -0
  182. parsek_cdp/cdp/schema/functions.py +32 -0
  183. parsek_cdp/cdp/schema/types.py +22 -0
  184. parsek_cdp/cdp/security/__init__.py +15 -0
  185. parsek_cdp/cdp/security/events.py +64 -0
  186. parsek_cdp/cdp/security/functions.py +66 -0
  187. parsek_cdp/cdp/security/types.py +168 -0
  188. parsek_cdp/cdp/serviceworker/__init__.py +15 -0
  189. parsek_cdp/cdp/serviceworker/events.py +43 -0
  190. parsek_cdp/cdp/serviceworker/functions.py +115 -0
  191. parsek_cdp/cdp/serviceworker/types.py +95 -0
  192. parsek_cdp/cdp/storage/__init__.py +15 -0
  193. parsek_cdp/cdp/storage/events.py +288 -0
  194. parsek_cdp/cdp/storage/functions.py +571 -0
  195. parsek_cdp/cdp/storage/types.py +656 -0
  196. parsek_cdp/cdp/systeminfo/__init__.py +15 -0
  197. parsek_cdp/cdp/systeminfo/events.py +13 -0
  198. parsek_cdp/cdp/systeminfo/functions.py +75 -0
  199. parsek_cdp/cdp/systeminfo/types.py +132 -0
  200. parsek_cdp/cdp/target/__init__.py +15 -0
  201. parsek_cdp/cdp/target/events.py +109 -0
  202. parsek_cdp/cdp/target/functions.py +424 -0
  203. parsek_cdp/cdp/target/types.py +83 -0
  204. parsek_cdp/cdp/tethering/__init__.py +15 -0
  205. parsek_cdp/cdp/tethering/events.py +22 -0
  206. parsek_cdp/cdp/tethering/functions.py +35 -0
  207. parsek_cdp/cdp/tethering/types.py +10 -0
  208. parsek_cdp/cdp/tracing/__init__.py +15 -0
  209. parsek_cdp/cdp/tracing/events.py +61 -0
  210. parsek_cdp/cdp/tracing/functions.py +119 -0
  211. parsek_cdp/cdp/tracing/types.py +81 -0
  212. parsek_cdp/cdp/webaudio/__init__.py +15 -0
  213. parsek_cdp/cdp/webaudio/events.py +184 -0
  214. parsek_cdp/cdp/webaudio/functions.py +51 -0
  215. parsek_cdp/cdp/webaudio/types.py +155 -0
  216. parsek_cdp/cdp/webauthn/__init__.py +15 -0
  217. parsek_cdp/cdp/webauthn/events.py +69 -0
  218. parsek_cdp/cdp/webauthn/functions.py +214 -0
  219. parsek_cdp/cdp/webauthn/types.py +96 -0
  220. parsek_cdp/core/__init__.py +18 -0
  221. parsek_cdp/core/browser.py +240 -0
  222. parsek_cdp/core/browser_context.py +58 -0
  223. parsek_cdp/core/element.py +405 -0
  224. parsek_cdp/core/feature.py +376 -0
  225. parsek_cdp/core/frame.py +351 -0
  226. parsek_cdp/core/pagable.py +175 -0
  227. parsek_cdp/core/page.py +163 -0
  228. parsek_cdp/core/target.py +490 -0
  229. parsek_cdp/features/__init__.py +14 -0
  230. parsek_cdp/features/request_listener/__init__.py +256 -0
  231. parsek_cdp/features/request_listener/events.py +48 -0
  232. parsek_cdp/features/request_listener/types.py +235 -0
  233. parsek_cdp/generate.py +642 -0
  234. parsek_cdp/parsek/__init__.py +18 -0
  235. parsek_cdp/parsek/events.py +38 -0
  236. parsek_cdp/parsek/types.py +36 -0
  237. parsek_cdp/py.typed +0 -0
  238. parsek_cdp-0.1.0.dist-info/METADATA +277 -0
  239. parsek_cdp-0.1.0.dist-info/RECORD +242 -0
  240. parsek_cdp-0.1.0.dist-info/WHEEL +5 -0
  241. parsek_cdp-0.1.0.dist-info/licenses/LICENSE +201 -0
  242. parsek_cdp-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,93 @@
1
+ """Commands for the FedCm 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
+ AccountUrlType,
12
+ DialogButton,
13
+ )
14
+
15
+ class FedCm:
16
+ """Commands of the FedCm domain, bound to a target."""
17
+
18
+ def __init__(self, target: Any) -> None:
19
+ self._target = target
20
+
21
+
22
+ async def enable(self, *, disable_rejection_delay: Optional[bool] = None) -> None:
23
+ """
24
+ :param disable_rejection_delay: Allows callers to disable the promise rejection delay that would
25
+ normally happen, if this is unimportant to what's being tested.
26
+ (step 4 of https://fedidcg.github.io/FedCM/#browser-api-rp-sign-in)
27
+ """
28
+ _params: Dict[str, Any] = {}
29
+ if disable_rejection_delay is not None:
30
+ _params['disableRejectionDelay'] = encode(FieldMeta('', '', False, 'primitive'), disable_rejection_delay)
31
+ _result = await self._target.send('FedCm.enable', _params)
32
+ return None
33
+
34
+ async def disable(self) -> None:
35
+ _params: Dict[str, Any] = {}
36
+ _result = await self._target.send('FedCm.disable', _params)
37
+ return None
38
+
39
+ async def select_account(self, *, dialog_id: str, account_index: int) -> None:
40
+ """
41
+ :param dialog_id:
42
+ :param account_index:
43
+ """
44
+ _params: Dict[str, Any] = {}
45
+ _params['dialogId'] = encode(FieldMeta('', '', False, 'primitive'), dialog_id)
46
+ _params['accountIndex'] = encode(FieldMeta('', '', False, 'primitive'), account_index)
47
+ _result = await self._target.send('FedCm.selectAccount', _params)
48
+ return None
49
+
50
+ async def click_dialog_button(self, *, dialog_id: str, dialog_button: DialogButton) -> None:
51
+ """
52
+ :param dialog_id:
53
+ :param dialog_button:
54
+ """
55
+ _params: Dict[str, Any] = {}
56
+ _params['dialogId'] = encode(FieldMeta('', '', False, 'primitive'), dialog_id)
57
+ _params['dialogButton'] = encode(FieldMeta('', '', False, 'enum', ref='FedCm.DialogButton'), dialog_button)
58
+ _result = await self._target.send('FedCm.clickDialogButton', _params)
59
+ return None
60
+
61
+ async def open_url(self, *, dialog_id: str, account_index: int, account_url_type: AccountUrlType) -> None:
62
+ """
63
+ :param dialog_id:
64
+ :param account_index:
65
+ :param account_url_type:
66
+ """
67
+ _params: Dict[str, Any] = {}
68
+ _params['dialogId'] = encode(FieldMeta('', '', False, 'primitive'), dialog_id)
69
+ _params['accountIndex'] = encode(FieldMeta('', '', False, 'primitive'), account_index)
70
+ _params['accountUrlType'] = encode(FieldMeta('', '', False, 'enum', ref='FedCm.AccountUrlType'), account_url_type)
71
+ _result = await self._target.send('FedCm.openUrl', _params)
72
+ return None
73
+
74
+ async def dismiss_dialog(self, *, dialog_id: str, trigger_cooldown: Optional[bool] = None) -> None:
75
+ """
76
+ :param dialog_id:
77
+ :param trigger_cooldown:
78
+ """
79
+ _params: Dict[str, Any] = {}
80
+ _params['dialogId'] = encode(FieldMeta('', '', False, 'primitive'), dialog_id)
81
+ if trigger_cooldown is not None:
82
+ _params['triggerCooldown'] = encode(FieldMeta('', '', False, 'primitive'), trigger_cooldown)
83
+ _result = await self._target.send('FedCm.dismissDialog', _params)
84
+ return None
85
+
86
+ async def reset_cooldown(self) -> None:
87
+ """
88
+ Resets the cooldown time, if any, to allow the next FedCM call to show
89
+ a dialog even if one was recently dismissed by the user.
90
+ """
91
+ _params: Dict[str, Any] = {}
92
+ _result = await self._target.send('FedCm.resetCooldown', _params)
93
+ return None
@@ -0,0 +1,72 @@
1
+ """Custom types and enums for the FedCm 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
+ @register("FedCm.LoginState")
12
+ class LoginState(str, Enum):
13
+ """
14
+ Whether this is a sign-up or sign-in action for this account, i.e.
15
+ whether this account has ever been used to sign in to this RP before.
16
+ """
17
+ SIGNIN = 'SignIn'
18
+ SIGNUP = 'SignUp'
19
+
20
+
21
+ @register("FedCm.DialogType")
22
+ class DialogType(str, Enum):
23
+ """The types of FedCM dialogs."""
24
+ ACCOUNTCHOOSER = 'AccountChooser'
25
+ AUTOREAUTHN = 'AutoReauthn'
26
+ CONFIRMIDPLOGIN = 'ConfirmIdpLogin'
27
+ ERROR = 'Error'
28
+
29
+
30
+ @register("FedCm.DialogButton")
31
+ class DialogButton(str, Enum):
32
+ """The buttons on the FedCM dialog."""
33
+ CONFIRMIDPLOGINCONTINUE = 'ConfirmIdpLoginContinue'
34
+ ERRORGOTIT = 'ErrorGotIt'
35
+ ERRORMOREDETAILS = 'ErrorMoreDetails'
36
+
37
+
38
+ @register("FedCm.AccountUrlType")
39
+ class AccountUrlType(str, Enum):
40
+ """The URLs that each account has"""
41
+ TERMSOFSERVICE = 'TermsOfService'
42
+ PRIVACYPOLICY = 'PrivacyPolicy'
43
+
44
+
45
+ @register("FedCm.Account")
46
+ @dataclass
47
+ class Account(DataType):
48
+ """Corresponds to IdentityRequestAccount"""
49
+ account_id: str
50
+ email: str
51
+ name: str
52
+ given_name: str
53
+ picture_url: str
54
+ idp_config_url: str
55
+ idp_login_url: str
56
+ login_state: LoginState
57
+ terms_of_service_url: Optional[str] = None
58
+ privacy_policy_url: Optional[str] = None
59
+ __FIELDS__: ClassVar[tuple] = (
60
+ FieldMeta('account_id', 'accountId', False, 'primitive'),
61
+ FieldMeta('email', 'email', False, 'primitive'),
62
+ FieldMeta('name', 'name', False, 'primitive'),
63
+ FieldMeta('given_name', 'givenName', False, 'primitive'),
64
+ FieldMeta('picture_url', 'pictureUrl', False, 'primitive'),
65
+ FieldMeta('idp_config_url', 'idpConfigUrl', False, 'primitive'),
66
+ FieldMeta('idp_login_url', 'idpLoginUrl', False, 'primitive'),
67
+ FieldMeta('login_state', 'loginState', False, 'enum', ref='FedCm.LoginState'),
68
+ FieldMeta('terms_of_service_url', 'termsOfServiceUrl', True, 'primitive'),
69
+ FieldMeta('privacy_policy_url', 'privacyPolicyUrl', True, 'primitive'),
70
+ )
71
+
72
+ __all__ = ["Account", "AccountUrlType", "DialogButton", "DialogType", "LoginState"]
@@ -0,0 +1,15 @@
1
+ """The Fetch CDP domain (generated).
2
+
3
+ Importing ``Fetch`` from ``parsek_cdp.cdp`` gives a namespace with this
4
+ domain's events and types as attributes (``Fetch.SomeEvent`` /
5
+ ``Fetch.SomeType``); commands run on a target via ``page.cdp.Fetch``.
6
+ """
7
+ from . import events, functions, types
8
+ from .functions import Fetch
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=(Fetch,)``).
13
+ DOMAIN = "Fetch"
14
+
15
+ __all__ = ["events", "functions", "types", "Fetch", "DOMAIN"]
@@ -0,0 +1,82 @@
1
+ """Events for the Fetch 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 FieldMeta
8
+ from ..mixins.event import Event, register_event
9
+
10
+ if TYPE_CHECKING:
11
+ from .types import (
12
+ AuthChallenge,
13
+ HeaderEntry,
14
+ RequestId,
15
+ )
16
+ from ..network.types import ErrorReason as Network_ErrorReason
17
+ from ..network.types import Request as Network_Request
18
+ from ..network.types import RequestId as Network_RequestId
19
+ from ..network.types import ResourceType as Network_ResourceType
20
+ from ..page.types import FrameId as Page_FrameId
21
+
22
+ @register_event("Fetch.requestPaused")
23
+ @dataclass
24
+ class RequestPaused(Event):
25
+ """
26
+ Issued when the domain is enabled and the request URL matches the
27
+ specified filter. The request is paused until the client responds
28
+ with one of continueRequest, failRequest or fulfillRequest.
29
+ The stage of the request can be determined by presence of responseErrorReason
30
+ and responseStatusCode -- the request is at the response stage if either
31
+ of these fields is present and in the request stage otherwise.
32
+ Redirect responses and subsequent requests are reported similarly to regular
33
+ responses and requests. Redirect responses may be distinguished by the value
34
+ of `responseStatusCode` (which is one of 301, 302, 303, 307, 308) along with
35
+ presence of the `location` header. Requests resulting from a redirect will
36
+ have `redirectedRequestId` field set.
37
+ """
38
+ request_id: RequestId
39
+ request: Network_Request
40
+ frame_id: Page_FrameId
41
+ resource_type: Network_ResourceType
42
+ response_error_reason: Optional[Network_ErrorReason] = None
43
+ response_status_code: Optional[int] = None
44
+ response_status_text: Optional[str] = None
45
+ response_headers: Optional[List[HeaderEntry]] = None
46
+ network_id: Optional[Network_RequestId] = None
47
+ redirected_request_id: Optional[RequestId] = None
48
+ __FIELDS__: ClassVar[tuple] = (
49
+ FieldMeta('request_id', 'requestId', False, 'primitive'),
50
+ FieldMeta('request', 'request', False, 'object', ref='Network.Request'),
51
+ FieldMeta('frame_id', 'frameId', False, 'primitive'),
52
+ FieldMeta('resource_type', 'resourceType', False, 'enum', ref='Network.ResourceType'),
53
+ FieldMeta('response_error_reason', 'responseErrorReason', True, 'enum', ref='Network.ErrorReason'),
54
+ FieldMeta('response_status_code', 'responseStatusCode', True, 'primitive'),
55
+ FieldMeta('response_status_text', 'responseStatusText', True, 'primitive'),
56
+ FieldMeta('response_headers', 'responseHeaders', True, 'array', inner=FieldMeta('', '', False, 'object', ref='Fetch.HeaderEntry')),
57
+ FieldMeta('network_id', 'networkId', True, 'primitive'),
58
+ FieldMeta('redirected_request_id', 'redirectedRequestId', True, 'primitive'),
59
+ )
60
+
61
+
62
+ @register_event("Fetch.authRequired")
63
+ @dataclass
64
+ class AuthRequired(Event):
65
+ """
66
+ Issued when the domain is enabled with handleAuthRequests set to true.
67
+ The request is paused until client responds with continueWithAuth.
68
+ """
69
+ request_id: RequestId
70
+ request: Network_Request
71
+ frame_id: Page_FrameId
72
+ resource_type: Network_ResourceType
73
+ auth_challenge: AuthChallenge
74
+ __FIELDS__: ClassVar[tuple] = (
75
+ FieldMeta('request_id', 'requestId', False, 'primitive'),
76
+ FieldMeta('request', 'request', False, 'object', ref='Network.Request'),
77
+ FieldMeta('frame_id', 'frameId', False, 'primitive'),
78
+ FieldMeta('resource_type', 'resourceType', False, 'enum', ref='Network.ResourceType'),
79
+ FieldMeta('auth_challenge', 'authChallenge', False, 'object', ref='Fetch.AuthChallenge'),
80
+ )
81
+
82
+ __all__ = ["AuthRequired", "RequestPaused"]
@@ -0,0 +1,215 @@
1
+ """Commands for the Fetch 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
+ AuthChallengeResponse,
12
+ HeaderEntry,
13
+ RequestId,
14
+ RequestPattern,
15
+ )
16
+ from ..io.types import StreamHandle as IO_StreamHandle
17
+ from ..network.types import ErrorReason as Network_ErrorReason
18
+
19
+ @dataclass
20
+ class GetResponseBodyReturn(DataType):
21
+ """Return value of :meth:`Fetch.get_response_body`."""
22
+ body: str
23
+ base64_encoded: bool
24
+ __FIELDS__: ClassVar[tuple] = (
25
+ FieldMeta('body', 'body', False, 'primitive'),
26
+ FieldMeta('base64_encoded', 'base64Encoded', False, 'primitive'),
27
+ )
28
+
29
+
30
+ @dataclass
31
+ class TakeResponseBodyAsStreamReturn(DataType):
32
+ """Return value of :meth:`Fetch.take_response_body_as_stream`."""
33
+ stream: IO_StreamHandle
34
+ __FIELDS__: ClassVar[tuple] = (
35
+ FieldMeta('stream', 'stream', False, 'primitive'),
36
+ )
37
+
38
+
39
+ class Fetch:
40
+ """Commands of the Fetch domain, bound to a target."""
41
+
42
+ def __init__(self, target: Any) -> None:
43
+ self._target = target
44
+
45
+
46
+ async def disable(self) -> None:
47
+ """Disables the fetch domain."""
48
+ _params: Dict[str, Any] = {}
49
+ _result = await self._target.send('Fetch.disable', _params)
50
+ return None
51
+
52
+ async def enable(self, *, patterns: Optional[List[RequestPattern]] = None, handle_auth_requests: Optional[bool] = None) -> None:
53
+ """
54
+ Enables issuing of requestPaused events. A request will be paused until client
55
+ calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.
56
+ :param patterns: If specified, only requests matching any of these patterns will produce
57
+ fetchRequested event and will be paused until clients response. If not set,
58
+ all requests will be affected.
59
+ :param handle_auth_requests: If true, authRequired events will be issued and requests will be paused
60
+ expecting a call to continueWithAuth.
61
+ """
62
+ _params: Dict[str, Any] = {}
63
+ if patterns is not None:
64
+ _params['patterns'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Fetch.RequestPattern')), patterns)
65
+ if handle_auth_requests is not None:
66
+ _params['handleAuthRequests'] = encode(FieldMeta('', '', False, 'primitive'), handle_auth_requests)
67
+ _result = await self._target.send('Fetch.enable', _params)
68
+ return None
69
+
70
+ async def fail_request(self, *, request_id: RequestId, error_reason: Network_ErrorReason) -> None:
71
+ """
72
+ Causes the request to fail with specified reason.
73
+ :param request_id: An id the client received in requestPaused event.
74
+ :param error_reason: Causes the request to fail with the given reason.
75
+ """
76
+ _params: Dict[str, Any] = {}
77
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
78
+ _params['errorReason'] = encode(FieldMeta('', '', False, 'enum', ref='Network.ErrorReason'), error_reason)
79
+ _result = await self._target.send('Fetch.failRequest', _params)
80
+ return None
81
+
82
+ async def fulfill_request(self, *, request_id: RequestId, response_code: int, response_headers: Optional[List[HeaderEntry]] = None, binary_response_headers: Optional[str] = None, body: Optional[str] = None, response_phrase: Optional[str] = None) -> None:
83
+ """
84
+ Provides response to the request.
85
+ :param request_id: An id the client received in requestPaused event.
86
+ :param response_code: An HTTP response code.
87
+ :param response_headers: Response headers.
88
+ :param binary_response_headers: Alternative way of specifying response headers as a \\0-separated
89
+ series of name: value pairs. Prefer the above method unless you
90
+ need to represent some non-UTF8 values that can't be transmitted
91
+ over the protocol as text. (Encoded as a base64 string when passed over JSON)
92
+ :param body: A response body. If absent, original response body will be used if
93
+ the request is intercepted at the response stage and empty body
94
+ will be used if the request is intercepted at the request stage. (Encoded as a base64 string when passed over JSON)
95
+ :param response_phrase: A textual representation of responseCode.
96
+ If absent, a standard phrase matching responseCode is used.
97
+ """
98
+ _params: Dict[str, Any] = {}
99
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
100
+ _params['responseCode'] = encode(FieldMeta('', '', False, 'primitive'), response_code)
101
+ if response_headers is not None:
102
+ _params['responseHeaders'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Fetch.HeaderEntry')), response_headers)
103
+ if binary_response_headers is not None:
104
+ _params['binaryResponseHeaders'] = encode(FieldMeta('', '', False, 'primitive'), binary_response_headers)
105
+ if body is not None:
106
+ _params['body'] = encode(FieldMeta('', '', False, 'primitive'), body)
107
+ if response_phrase is not None:
108
+ _params['responsePhrase'] = encode(FieldMeta('', '', False, 'primitive'), response_phrase)
109
+ _result = await self._target.send('Fetch.fulfillRequest', _params)
110
+ return None
111
+
112
+ async def continue_request(self, *, request_id: RequestId, url: Optional[str] = None, method: Optional[str] = None, post_data: Optional[str] = None, headers: Optional[List[HeaderEntry]] = None, intercept_response: Optional[bool] = None) -> None:
113
+ """
114
+ Continues the request, optionally modifying some of its parameters.
115
+ :param request_id: An id the client received in requestPaused event.
116
+ :param url: If set, the request url will be modified in a way that's not observable by page.
117
+ :param method: If set, the request method is overridden.
118
+ :param post_data: If set, overrides the post data in the request. (Encoded as a base64 string when passed over JSON)
119
+ :param headers: If set, overrides the request headers. Note that the overrides do not
120
+ extend to subsequent redirect hops, if a redirect happens. Another override
121
+ may be applied to a different request produced by a redirect.
122
+ :param intercept_response: If set, overrides response interception behavior for this request.
123
+ """
124
+ _params: Dict[str, Any] = {}
125
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
126
+ if url is not None:
127
+ _params['url'] = encode(FieldMeta('', '', False, 'primitive'), url)
128
+ if method is not None:
129
+ _params['method'] = encode(FieldMeta('', '', False, 'primitive'), method)
130
+ if post_data is not None:
131
+ _params['postData'] = encode(FieldMeta('', '', False, 'primitive'), post_data)
132
+ if headers is not None:
133
+ _params['headers'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Fetch.HeaderEntry')), headers)
134
+ if intercept_response is not None:
135
+ _params['interceptResponse'] = encode(FieldMeta('', '', False, 'primitive'), intercept_response)
136
+ _result = await self._target.send('Fetch.continueRequest', _params)
137
+ return None
138
+
139
+ async def continue_with_auth(self, *, request_id: RequestId, auth_challenge_response: AuthChallengeResponse) -> None:
140
+ """
141
+ Continues a request supplying authChallengeResponse following authRequired event.
142
+ :param request_id: An id the client received in authRequired event.
143
+ :param auth_challenge_response: Response to with an authChallenge.
144
+ """
145
+ _params: Dict[str, Any] = {}
146
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
147
+ _params['authChallengeResponse'] = encode(FieldMeta('', '', False, 'object', ref='Fetch.AuthChallengeResponse'), auth_challenge_response)
148
+ _result = await self._target.send('Fetch.continueWithAuth', _params)
149
+ return None
150
+
151
+ async def continue_response(self, *, request_id: RequestId, response_code: Optional[int] = None, response_phrase: Optional[str] = None, response_headers: Optional[List[HeaderEntry]] = None, binary_response_headers: Optional[str] = None) -> None:
152
+ """
153
+ Continues loading of the paused response, optionally modifying the
154
+ response headers. If either responseCode or headers are modified, all of them
155
+ must be present.
156
+ :param request_id: An id the client received in requestPaused event.
157
+ :param response_code: An HTTP response code. If absent, original response code will be used.
158
+ :param response_phrase: A textual representation of responseCode.
159
+ If absent, a standard phrase matching responseCode is used.
160
+ :param response_headers: Response headers. If absent, original response headers will be used.
161
+ :param binary_response_headers: Alternative way of specifying response headers as a \\0-separated
162
+ series of name: value pairs. Prefer the above method unless you
163
+ need to represent some non-UTF8 values that can't be transmitted
164
+ over the protocol as text. (Encoded as a base64 string when passed over JSON)
165
+ """
166
+ _params: Dict[str, Any] = {}
167
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
168
+ if response_code is not None:
169
+ _params['responseCode'] = encode(FieldMeta('', '', False, 'primitive'), response_code)
170
+ if response_phrase is not None:
171
+ _params['responsePhrase'] = encode(FieldMeta('', '', False, 'primitive'), response_phrase)
172
+ if response_headers is not None:
173
+ _params['responseHeaders'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='Fetch.HeaderEntry')), response_headers)
174
+ if binary_response_headers is not None:
175
+ _params['binaryResponseHeaders'] = encode(FieldMeta('', '', False, 'primitive'), binary_response_headers)
176
+ _result = await self._target.send('Fetch.continueResponse', _params)
177
+ return None
178
+
179
+ async def get_response_body(self, *, request_id: RequestId) -> GetResponseBodyReturn:
180
+ """
181
+ Causes the body of the response to be received from the server and
182
+ returned as a single string. May only be issued for a request that
183
+ is paused in the Response stage and is mutually exclusive with
184
+ takeResponseBodyForInterceptionAsStream. Calling other methods that
185
+ affect the request or disabling fetch domain before body is received
186
+ results in an undefined behavior.
187
+ Note that the response body is not available for redirects. Requests
188
+ paused in the _redirect received_ state may be differentiated by
189
+ `responseCode` and presence of `location` response header, see
190
+ comments to `requestPaused` for details.
191
+ :param request_id: Identifier for the intercepted request to get body for.
192
+ """
193
+ _params: Dict[str, Any] = {}
194
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
195
+ _result = await self._target.send('Fetch.getResponseBody', _params)
196
+ return GetResponseBodyReturn.from_json(_result)
197
+
198
+ async def take_response_body_as_stream(self, *, request_id: RequestId) -> TakeResponseBodyAsStreamReturn:
199
+ """
200
+ Returns a handle to the stream representing the response body.
201
+ The request must be paused in the HeadersReceived stage.
202
+ Note that after this command the request can't be continued
203
+ as is -- client either needs to cancel it or to provide the
204
+ response body.
205
+ The stream only supports sequential read, IO.read will fail if the position
206
+ is specified.
207
+ This method is mutually exclusive with getResponseBody.
208
+ Calling other methods that affect the request or disabling fetch
209
+ domain before body is received results in an undefined behavior.
210
+ :param request_id:
211
+ """
212
+ _params: Dict[str, Any] = {}
213
+ _params['requestId'] = encode(FieldMeta('', '', False, 'primitive'), request_id)
214
+ _result = await self._target.send('Fetch.takeResponseBodyAsStream', _params)
215
+ return TakeResponseBodyAsStreamReturn.from_json(_result)
@@ -0,0 +1,81 @@
1
+ """Custom types and enums for the Fetch domain (generated)."""
2
+ from __future__ import annotations
3
+
4
+ from dataclasses import dataclass
5
+ from enum import Enum
6
+ from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
7
+
8
+ from ..mixins.datatype import DataType, FieldMeta, register
9
+
10
+ if TYPE_CHECKING:
11
+ from ..network.types import ResourceType as Network_ResourceType
12
+
13
+ type RequestId = str # Unique request identifier.
14
+
15
+
16
+ @register("Fetch.RequestStage")
17
+ class RequestStage(str, Enum):
18
+ """
19
+ Stages of the request to handle. Request will intercept before the request is
20
+ sent. Response will intercept after the response is received (but before response
21
+ body is received).
22
+ """
23
+ REQUEST = 'Request'
24
+ RESPONSE = 'Response'
25
+
26
+
27
+ @register("Fetch.RequestPattern")
28
+ @dataclass
29
+ class RequestPattern(DataType):
30
+ url_pattern: Optional[str] = None
31
+ resource_type: Optional[Network_ResourceType] = None
32
+ request_stage: Optional[RequestStage] = None
33
+ __FIELDS__: ClassVar[tuple] = (
34
+ FieldMeta('url_pattern', 'urlPattern', True, 'primitive'),
35
+ FieldMeta('resource_type', 'resourceType', True, 'enum', ref='Network.ResourceType'),
36
+ FieldMeta('request_stage', 'requestStage', True, 'enum', ref='Fetch.RequestStage'),
37
+ )
38
+
39
+
40
+ @register("Fetch.HeaderEntry")
41
+ @dataclass
42
+ class HeaderEntry(DataType):
43
+ """Response HTTP header entry"""
44
+ name: str
45
+ value: str
46
+ __FIELDS__: ClassVar[tuple] = (
47
+ FieldMeta('name', 'name', False, 'primitive'),
48
+ FieldMeta('value', 'value', False, 'primitive'),
49
+ )
50
+
51
+
52
+ @register("Fetch.AuthChallenge")
53
+ @dataclass
54
+ class AuthChallenge(DataType):
55
+ """Authorization challenge for HTTP status code 401 or 407."""
56
+ origin: str
57
+ scheme: str
58
+ realm: str
59
+ source: Optional[Literal['Server', 'Proxy']] = None
60
+ __FIELDS__: ClassVar[tuple] = (
61
+ FieldMeta('origin', 'origin', False, 'primitive'),
62
+ FieldMeta('scheme', 'scheme', False, 'primitive'),
63
+ FieldMeta('realm', 'realm', False, 'primitive'),
64
+ FieldMeta('source', 'source', True, 'primitive'),
65
+ )
66
+
67
+
68
+ @register("Fetch.AuthChallengeResponse")
69
+ @dataclass
70
+ class AuthChallengeResponse(DataType):
71
+ """Response to an AuthChallenge."""
72
+ response: Literal['Default', 'CancelAuth', 'ProvideCredentials']
73
+ username: Optional[str] = None
74
+ password: Optional[str] = None
75
+ __FIELDS__: ClassVar[tuple] = (
76
+ FieldMeta('response', 'response', False, 'primitive'),
77
+ FieldMeta('username', 'username', True, 'primitive'),
78
+ FieldMeta('password', 'password', True, 'primitive'),
79
+ )
80
+
81
+ __all__ = ["AuthChallenge", "AuthChallengeResponse", "HeaderEntry", "RequestId", "RequestPattern", "RequestStage"]
@@ -0,0 +1,15 @@
1
+ """The FileSystem CDP domain (generated).
2
+
3
+ Importing ``FileSystem`` from ``parsek_cdp.cdp`` gives a namespace with this
4
+ domain's events and types as attributes (``FileSystem.SomeEvent`` /
5
+ ``FileSystem.SomeType``); commands run on a target via ``page.cdp.FileSystem``.
6
+ """
7
+ from . import events, functions, types
8
+ from .functions import FileSystem
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=(FileSystem,)``).
13
+ DOMAIN = "FileSystem"
14
+
15
+ __all__ = ["events", "functions", "types", "FileSystem", "DOMAIN"]
@@ -0,0 +1,13 @@
1
+ """Events for the FileSystem 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,36 @@
1
+ """Commands for the FileSystem 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
+ BucketFileSystemLocator,
12
+ Directory,
13
+ )
14
+
15
+ @dataclass
16
+ class GetDirectoryReturn(DataType):
17
+ """Return value of :meth:`FileSystem.get_directory`."""
18
+ directory: Directory
19
+ __FIELDS__: ClassVar[tuple] = (
20
+ FieldMeta('directory', 'directory', False, 'object', ref='FileSystem.Directory'),
21
+ )
22
+
23
+
24
+ class FileSystem:
25
+ """Commands of the FileSystem domain, bound to a target."""
26
+
27
+ def __init__(self, target: Any) -> None:
28
+ self._target = target
29
+
30
+
31
+ async def get_directory(self, *, bucket_file_system_locator: BucketFileSystemLocator) -> GetDirectoryReturn:
32
+ """:param bucket_file_system_locator:"""
33
+ _params: Dict[str, Any] = {}
34
+ _params['bucketFileSystemLocator'] = encode(FieldMeta('', '', False, 'object', ref='FileSystem.BucketFileSystemLocator'), bucket_file_system_locator)
35
+ _result = await self._target.send('FileSystem.getDirectory', _params)
36
+ return GetDirectoryReturn.from_json(_result)