mithwire 0.50.3__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 (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,179 @@
1
+ # DO NOT EDIT THIS FILE!
2
+ #
3
+ # This file is generated from the CDP specification. If you need to make
4
+ # changes, edit the generator and regenerate all of the modules.
5
+ #
6
+ # CDP domain: Database (experimental)
7
+
8
+ from __future__ import annotations
9
+
10
+ import typing
11
+ from dataclasses import dataclass
12
+
13
+ from .util import T_JSON_DICT, event_class
14
+
15
+
16
+ class DatabaseId(str):
17
+ """
18
+ Unique identifier of Database object.
19
+ """
20
+
21
+ def to_json(self) -> str:
22
+ return self
23
+
24
+ @classmethod
25
+ def from_json(cls, json: str) -> DatabaseId:
26
+ return cls(json)
27
+
28
+ def __repr__(self):
29
+ return "DatabaseId({})".format(super().__repr__())
30
+
31
+
32
+ @dataclass
33
+ class Database:
34
+ """
35
+ Database object.
36
+ """
37
+
38
+ #: Database ID.
39
+ id_: DatabaseId
40
+
41
+ #: Database domain.
42
+ domain: str
43
+
44
+ #: Database name.
45
+ name: str
46
+
47
+ #: Database version.
48
+ version: str
49
+
50
+ def to_json(self) -> T_JSON_DICT:
51
+ json: T_JSON_DICT = dict()
52
+ json["id"] = self.id_.to_json()
53
+ json["domain"] = self.domain
54
+ json["name"] = self.name
55
+ json["version"] = self.version
56
+ return json
57
+
58
+ @classmethod
59
+ def from_json(cls, json: T_JSON_DICT) -> Database:
60
+ return cls(
61
+ id_=DatabaseId.from_json(json["id"]),
62
+ domain=str(json["domain"]),
63
+ name=str(json["name"]),
64
+ version=str(json["version"]),
65
+ )
66
+
67
+
68
+ @dataclass
69
+ class Error:
70
+ """
71
+ Database error.
72
+ """
73
+
74
+ #: Error message.
75
+ message: str
76
+
77
+ #: Error code.
78
+ code: int
79
+
80
+ def to_json(self) -> T_JSON_DICT:
81
+ json: T_JSON_DICT = dict()
82
+ json["message"] = self.message
83
+ json["code"] = self.code
84
+ return json
85
+
86
+ @classmethod
87
+ def from_json(cls, json: T_JSON_DICT) -> Error:
88
+ return cls(
89
+ message=str(json["message"]),
90
+ code=int(json["code"]),
91
+ )
92
+
93
+
94
+ def disable() -> typing.Generator[T_JSON_DICT, T_JSON_DICT, None]:
95
+ """
96
+ Disables database tracking, prevents database events from being sent to the client.
97
+ """
98
+ cmd_dict: T_JSON_DICT = {
99
+ "method": "Database.disable",
100
+ }
101
+ json = yield cmd_dict
102
+
103
+
104
+ def enable() -> typing.Generator[T_JSON_DICT, T_JSON_DICT, None]:
105
+ """
106
+ Enables database tracking, database events will now be delivered to the client.
107
+ """
108
+ cmd_dict: T_JSON_DICT = {
109
+ "method": "Database.enable",
110
+ }
111
+ json = yield cmd_dict
112
+
113
+
114
+ def execute_sql(database_id: DatabaseId, query: str) -> typing.Generator[
115
+ T_JSON_DICT,
116
+ T_JSON_DICT,
117
+ typing.Tuple[
118
+ typing.Optional[typing.List[str]],
119
+ typing.Optional[typing.List[typing.Any]],
120
+ typing.Optional[Error],
121
+ ],
122
+ ]:
123
+ """
124
+ :param database_id:
125
+ :param query:
126
+ :returns: A tuple with the following items:
127
+
128
+ 0. **columnNames** -
129
+ 1. **values** -
130
+ 2. **sqlError** -
131
+ """
132
+ params: T_JSON_DICT = dict()
133
+ params["databaseId"] = database_id.to_json()
134
+ params["query"] = query
135
+ cmd_dict: T_JSON_DICT = {
136
+ "method": "Database.executeSQL",
137
+ "params": params,
138
+ }
139
+ json = yield cmd_dict
140
+ return (
141
+ (
142
+ [str(i) for i in json["columnNames"]]
143
+ if json.get("columnNames", None) is not None
144
+ else None
145
+ ),
146
+ [i for i in json["values"]] if json.get("values", None) is not None else None,
147
+ (
148
+ Error.from_json(json["sqlError"])
149
+ if json.get("sqlError", None) is not None
150
+ else None
151
+ ),
152
+ )
153
+
154
+
155
+ def get_database_table_names(
156
+ database_id: DatabaseId,
157
+ ) -> typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[str]]:
158
+ """
159
+ :param database_id:
160
+ :returns:
161
+ """
162
+ params: T_JSON_DICT = dict()
163
+ params["databaseId"] = database_id.to_json()
164
+ cmd_dict: T_JSON_DICT = {
165
+ "method": "Database.getDatabaseTableNames",
166
+ "params": params,
167
+ }
168
+ json = yield cmd_dict
169
+ return [str(i) for i in json["tableNames"]]
170
+
171
+
172
+ @event_class("Database.addDatabase")
173
+ @dataclass
174
+ class AddDatabase:
175
+ database: Database
176
+
177
+ @classmethod
178
+ def from_json(cls, json: T_JSON_DICT) -> AddDatabase:
179
+ return cls(database=Database.from_json(json["database"]))