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,1573 @@
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: Storage (experimental)
7
+
8
+ from __future__ import annotations
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+ from . import browser
15
+ from . import network
16
+ from . import page
17
+ from . import target
18
+ from deprecated.sphinx import deprecated # type: ignore
19
+
20
+
21
+ class SerializedStorageKey(str):
22
+ def to_json(self) -> str:
23
+ return self
24
+
25
+ @classmethod
26
+ def from_json(cls, json: str) -> SerializedStorageKey:
27
+ return cls(json)
28
+
29
+ def __repr__(self):
30
+ return 'SerializedStorageKey({})'.format(super().__repr__())
31
+
32
+
33
+ class StorageType(enum.Enum):
34
+ '''
35
+ Enum of possible storage types.
36
+ '''
37
+ COOKIES = "cookies"
38
+ FILE_SYSTEMS = "file_systems"
39
+ INDEXEDDB = "indexeddb"
40
+ LOCAL_STORAGE = "local_storage"
41
+ SHADER_CACHE = "shader_cache"
42
+ WEBSQL = "websql"
43
+ SERVICE_WORKERS = "service_workers"
44
+ CACHE_STORAGE = "cache_storage"
45
+ INTEREST_GROUPS = "interest_groups"
46
+ SHARED_STORAGE = "shared_storage"
47
+ STORAGE_BUCKETS = "storage_buckets"
48
+ ALL_ = "all"
49
+ OTHER = "other"
50
+
51
+ def to_json(self) -> str:
52
+ return self.value
53
+
54
+ @classmethod
55
+ def from_json(cls, json: str) -> StorageType:
56
+ return cls(json)
57
+
58
+
59
+ @dataclass
60
+ class UsageForType:
61
+ '''
62
+ Usage for a storage type.
63
+ '''
64
+ #: Name of storage type.
65
+ storage_type: StorageType
66
+
67
+ #: Storage usage (bytes).
68
+ usage: float
69
+
70
+ def to_json(self) -> T_JSON_DICT:
71
+ json: T_JSON_DICT = dict()
72
+ json['storageType'] = self.storage_type.to_json()
73
+ json['usage'] = self.usage
74
+ return json
75
+
76
+ @classmethod
77
+ def from_json(cls, json: T_JSON_DICT) -> UsageForType:
78
+ return cls(
79
+ storage_type=StorageType.from_json(json['storageType']),
80
+ usage=float(json['usage']),
81
+ )
82
+
83
+
84
+ @dataclass
85
+ class TrustTokens:
86
+ '''
87
+ Pair of issuer origin and number of available (signed, but not used) Trust
88
+ Tokens from that issuer.
89
+ '''
90
+ issuer_origin: str
91
+
92
+ count: float
93
+
94
+ def to_json(self) -> T_JSON_DICT:
95
+ json: T_JSON_DICT = dict()
96
+ json['issuerOrigin'] = self.issuer_origin
97
+ json['count'] = self.count
98
+ return json
99
+
100
+ @classmethod
101
+ def from_json(cls, json: T_JSON_DICT) -> TrustTokens:
102
+ return cls(
103
+ issuer_origin=str(json['issuerOrigin']),
104
+ count=float(json['count']),
105
+ )
106
+
107
+
108
+ class InterestGroupAuctionId(str):
109
+ '''
110
+ Protected audience interest group auction identifier.
111
+ '''
112
+ def to_json(self) -> str:
113
+ return self
114
+
115
+ @classmethod
116
+ def from_json(cls, json: str) -> InterestGroupAuctionId:
117
+ return cls(json)
118
+
119
+ def __repr__(self):
120
+ return 'InterestGroupAuctionId({})'.format(super().__repr__())
121
+
122
+
123
+ class InterestGroupAccessType(enum.Enum):
124
+ '''
125
+ Enum of interest group access types.
126
+ '''
127
+ JOIN = "join"
128
+ LEAVE = "leave"
129
+ UPDATE = "update"
130
+ LOADED = "loaded"
131
+ BID = "bid"
132
+ WIN = "win"
133
+ ADDITIONAL_BID = "additionalBid"
134
+ ADDITIONAL_BID_WIN = "additionalBidWin"
135
+ TOP_LEVEL_BID = "topLevelBid"
136
+ TOP_LEVEL_ADDITIONAL_BID = "topLevelAdditionalBid"
137
+ CLEAR = "clear"
138
+
139
+ def to_json(self) -> str:
140
+ return self.value
141
+
142
+ @classmethod
143
+ def from_json(cls, json: str) -> InterestGroupAccessType:
144
+ return cls(json)
145
+
146
+
147
+ class InterestGroupAuctionEventType(enum.Enum):
148
+ '''
149
+ Enum of auction events.
150
+ '''
151
+ STARTED = "started"
152
+ CONFIG_RESOLVED = "configResolved"
153
+
154
+ def to_json(self) -> str:
155
+ return self.value
156
+
157
+ @classmethod
158
+ def from_json(cls, json: str) -> InterestGroupAuctionEventType:
159
+ return cls(json)
160
+
161
+
162
+ class InterestGroupAuctionFetchType(enum.Enum):
163
+ '''
164
+ Enum of network fetches auctions can do.
165
+ '''
166
+ BIDDER_JS = "bidderJs"
167
+ BIDDER_WASM = "bidderWasm"
168
+ SELLER_JS = "sellerJs"
169
+ BIDDER_TRUSTED_SIGNALS = "bidderTrustedSignals"
170
+ SELLER_TRUSTED_SIGNALS = "sellerTrustedSignals"
171
+
172
+ def to_json(self) -> str:
173
+ return self.value
174
+
175
+ @classmethod
176
+ def from_json(cls, json: str) -> InterestGroupAuctionFetchType:
177
+ return cls(json)
178
+
179
+
180
+ class SharedStorageAccessScope(enum.Enum):
181
+ '''
182
+ Enum of shared storage access scopes.
183
+ '''
184
+ WINDOW = "window"
185
+ SHARED_STORAGE_WORKLET = "sharedStorageWorklet"
186
+ PROTECTED_AUDIENCE_WORKLET = "protectedAudienceWorklet"
187
+ HEADER = "header"
188
+
189
+ def to_json(self) -> str:
190
+ return self.value
191
+
192
+ @classmethod
193
+ def from_json(cls, json: str) -> SharedStorageAccessScope:
194
+ return cls(json)
195
+
196
+
197
+ class SharedStorageAccessMethod(enum.Enum):
198
+ '''
199
+ Enum of shared storage access methods.
200
+ '''
201
+ ADD_MODULE = "addModule"
202
+ CREATE_WORKLET = "createWorklet"
203
+ SELECT_URL = "selectURL"
204
+ RUN = "run"
205
+ BATCH_UPDATE = "batchUpdate"
206
+ SET_ = "set"
207
+ APPEND = "append"
208
+ DELETE = "delete"
209
+ CLEAR = "clear"
210
+ GET = "get"
211
+ KEYS = "keys"
212
+ VALUES = "values"
213
+ ENTRIES = "entries"
214
+ LENGTH = "length"
215
+ REMAINING_BUDGET = "remainingBudget"
216
+
217
+ def to_json(self) -> str:
218
+ return self.value
219
+
220
+ @classmethod
221
+ def from_json(cls, json: str) -> SharedStorageAccessMethod:
222
+ return cls(json)
223
+
224
+
225
+ @dataclass
226
+ class SharedStorageEntry:
227
+ '''
228
+ Struct for a single key-value pair in an origin's shared storage.
229
+ '''
230
+ key: str
231
+
232
+ value: str
233
+
234
+ def to_json(self) -> T_JSON_DICT:
235
+ json: T_JSON_DICT = dict()
236
+ json['key'] = self.key
237
+ json['value'] = self.value
238
+ return json
239
+
240
+ @classmethod
241
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageEntry:
242
+ return cls(
243
+ key=str(json['key']),
244
+ value=str(json['value']),
245
+ )
246
+
247
+
248
+ @dataclass
249
+ class SharedStorageMetadata:
250
+ '''
251
+ Details for an origin's shared storage.
252
+ '''
253
+ #: Time when the origin's shared storage was last created.
254
+ creation_time: network.TimeSinceEpoch
255
+
256
+ #: Number of key-value pairs stored in origin's shared storage.
257
+ length: int
258
+
259
+ #: Current amount of bits of entropy remaining in the navigation budget.
260
+ remaining_budget: float
261
+
262
+ #: Total number of bytes stored as key-value pairs in origin's shared
263
+ #: storage.
264
+ bytes_used: int
265
+
266
+ def to_json(self) -> T_JSON_DICT:
267
+ json: T_JSON_DICT = dict()
268
+ json['creationTime'] = self.creation_time.to_json()
269
+ json['length'] = self.length
270
+ json['remainingBudget'] = self.remaining_budget
271
+ json['bytesUsed'] = self.bytes_used
272
+ return json
273
+
274
+ @classmethod
275
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageMetadata:
276
+ return cls(
277
+ creation_time=network.TimeSinceEpoch.from_json(json['creationTime']),
278
+ length=int(json['length']),
279
+ remaining_budget=float(json['remainingBudget']),
280
+ bytes_used=int(json['bytesUsed']),
281
+ )
282
+
283
+
284
+ @dataclass
285
+ class SharedStoragePrivateAggregationConfig:
286
+ '''
287
+ Represents a dictionary object passed in as privateAggregationConfig to
288
+ run or selectURL.
289
+ '''
290
+ #: Configures the maximum size allowed for filtering IDs.
291
+ filtering_id_max_bytes: int
292
+
293
+ #: The chosen aggregation service deployment.
294
+ aggregation_coordinator_origin: typing.Optional[str] = None
295
+
296
+ #: The context ID provided.
297
+ context_id: typing.Optional[str] = None
298
+
299
+ #: The limit on the number of contributions in the final report.
300
+ max_contributions: typing.Optional[int] = None
301
+
302
+ def to_json(self) -> T_JSON_DICT:
303
+ json: T_JSON_DICT = dict()
304
+ json['filteringIdMaxBytes'] = self.filtering_id_max_bytes
305
+ if self.aggregation_coordinator_origin is not None:
306
+ json['aggregationCoordinatorOrigin'] = self.aggregation_coordinator_origin
307
+ if self.context_id is not None:
308
+ json['contextId'] = self.context_id
309
+ if self.max_contributions is not None:
310
+ json['maxContributions'] = self.max_contributions
311
+ return json
312
+
313
+ @classmethod
314
+ def from_json(cls, json: T_JSON_DICT) -> SharedStoragePrivateAggregationConfig:
315
+ return cls(
316
+ filtering_id_max_bytes=int(json['filteringIdMaxBytes']),
317
+ aggregation_coordinator_origin=str(json['aggregationCoordinatorOrigin']) if json.get('aggregationCoordinatorOrigin', None) is not None else None,
318
+ context_id=str(json['contextId']) if json.get('contextId', None) is not None else None,
319
+ max_contributions=int(json['maxContributions']) if json.get('maxContributions', None) is not None else None,
320
+ )
321
+
322
+
323
+ @dataclass
324
+ class SharedStorageReportingMetadata:
325
+ '''
326
+ Pair of reporting metadata details for a candidate URL for ``selectURL()``.
327
+ '''
328
+ event_type: str
329
+
330
+ reporting_url: str
331
+
332
+ def to_json(self) -> T_JSON_DICT:
333
+ json: T_JSON_DICT = dict()
334
+ json['eventType'] = self.event_type
335
+ json['reportingUrl'] = self.reporting_url
336
+ return json
337
+
338
+ @classmethod
339
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageReportingMetadata:
340
+ return cls(
341
+ event_type=str(json['eventType']),
342
+ reporting_url=str(json['reportingUrl']),
343
+ )
344
+
345
+
346
+ @dataclass
347
+ class SharedStorageUrlWithMetadata:
348
+ '''
349
+ Bundles a candidate URL with its reporting metadata.
350
+ '''
351
+ #: Spec of candidate URL.
352
+ url: str
353
+
354
+ #: Any associated reporting metadata.
355
+ reporting_metadata: typing.List[SharedStorageReportingMetadata]
356
+
357
+ def to_json(self) -> T_JSON_DICT:
358
+ json: T_JSON_DICT = dict()
359
+ json['url'] = self.url
360
+ json['reportingMetadata'] = [i.to_json() for i in self.reporting_metadata]
361
+ return json
362
+
363
+ @classmethod
364
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageUrlWithMetadata:
365
+ return cls(
366
+ url=str(json['url']),
367
+ reporting_metadata=[SharedStorageReportingMetadata.from_json(i) for i in json['reportingMetadata']],
368
+ )
369
+
370
+
371
+ @dataclass
372
+ class SharedStorageAccessParams:
373
+ '''
374
+ Bundles the parameters for shared storage access events whose
375
+ presence/absence can vary according to SharedStorageAccessType.
376
+ '''
377
+ #: Spec of the module script URL.
378
+ #: Present only for SharedStorageAccessMethods: addModule and
379
+ #: createWorklet.
380
+ script_source_url: typing.Optional[str] = None
381
+
382
+ #: String denoting "context-origin", "script-origin", or a custom
383
+ #: origin to be used as the worklet's data origin.
384
+ #: Present only for SharedStorageAccessMethod: createWorklet.
385
+ data_origin: typing.Optional[str] = None
386
+
387
+ #: Name of the registered operation to be run.
388
+ #: Present only for SharedStorageAccessMethods: run and selectURL.
389
+ operation_name: typing.Optional[str] = None
390
+
391
+ #: ID of the operation call.
392
+ #: Present only for SharedStorageAccessMethods: run and selectURL.
393
+ operation_id: typing.Optional[str] = None
394
+
395
+ #: Whether or not to keep the worket alive for future run or selectURL
396
+ #: calls.
397
+ #: Present only for SharedStorageAccessMethods: run and selectURL.
398
+ keep_alive: typing.Optional[bool] = None
399
+
400
+ #: Configures the private aggregation options.
401
+ #: Present only for SharedStorageAccessMethods: run and selectURL.
402
+ private_aggregation_config: typing.Optional[SharedStoragePrivateAggregationConfig] = None
403
+
404
+ #: The operation's serialized data in bytes (converted to a string).
405
+ #: Present only for SharedStorageAccessMethods: run and selectURL.
406
+ #: TODO(crbug.com/401011862): Consider updating this parameter to binary.
407
+ serialized_data: typing.Optional[str] = None
408
+
409
+ #: Array of candidate URLs' specs, along with any associated metadata.
410
+ #: Present only for SharedStorageAccessMethod: selectURL.
411
+ urls_with_metadata: typing.Optional[typing.List[SharedStorageUrlWithMetadata]] = None
412
+
413
+ #: Spec of the URN:UUID generated for a selectURL call.
414
+ #: Present only for SharedStorageAccessMethod: selectURL.
415
+ urn_uuid: typing.Optional[str] = None
416
+
417
+ #: Key for a specific entry in an origin's shared storage.
418
+ #: Present only for SharedStorageAccessMethods: set, append, delete, and
419
+ #: get.
420
+ key: typing.Optional[str] = None
421
+
422
+ #: Value for a specific entry in an origin's shared storage.
423
+ #: Present only for SharedStorageAccessMethods: set and append.
424
+ value: typing.Optional[str] = None
425
+
426
+ #: Whether or not to set an entry for a key if that key is already present.
427
+ #: Present only for SharedStorageAccessMethod: set.
428
+ ignore_if_present: typing.Optional[bool] = None
429
+
430
+ #: A number denoting the (0-based) order of the worklet's
431
+ #: creation relative to all other shared storage worklets created by
432
+ #: documents using the current storage partition.
433
+ #: Present only for SharedStorageAccessMethods: addModule, createWorklet.
434
+ worklet_ordinal: typing.Optional[int] = None
435
+
436
+ #: Hex representation of the DevTools token used as the TargetID for the
437
+ #: associated shared storage worklet.
438
+ #: Present only for SharedStorageAccessMethods: addModule, createWorklet,
439
+ #: run, selectURL, and any other SharedStorageAccessMethod when the
440
+ #: SharedStorageAccessScope is sharedStorageWorklet.
441
+ worklet_target_id: typing.Optional[target.TargetID] = None
442
+
443
+ #: Name of the lock to be acquired, if present.
444
+ #: Optionally present only for SharedStorageAccessMethods: batchUpdate,
445
+ #: set, append, delete, and clear.
446
+ with_lock: typing.Optional[str] = None
447
+
448
+ #: If the method has been called as part of a batchUpdate, then this
449
+ #: number identifies the batch to which it belongs.
450
+ #: Optionally present only for SharedStorageAccessMethods:
451
+ #: batchUpdate (required), set, append, delete, and clear.
452
+ batch_update_id: typing.Optional[str] = None
453
+
454
+ #: Number of modifier methods sent in batch.
455
+ #: Present only for SharedStorageAccessMethod: batchUpdate.
456
+ batch_size: typing.Optional[int] = None
457
+
458
+ def to_json(self) -> T_JSON_DICT:
459
+ json: T_JSON_DICT = dict()
460
+ if self.script_source_url is not None:
461
+ json['scriptSourceUrl'] = self.script_source_url
462
+ if self.data_origin is not None:
463
+ json['dataOrigin'] = self.data_origin
464
+ if self.operation_name is not None:
465
+ json['operationName'] = self.operation_name
466
+ if self.operation_id is not None:
467
+ json['operationId'] = self.operation_id
468
+ if self.keep_alive is not None:
469
+ json['keepAlive'] = self.keep_alive
470
+ if self.private_aggregation_config is not None:
471
+ json['privateAggregationConfig'] = self.private_aggregation_config.to_json()
472
+ if self.serialized_data is not None:
473
+ json['serializedData'] = self.serialized_data
474
+ if self.urls_with_metadata is not None:
475
+ json['urlsWithMetadata'] = [i.to_json() for i in self.urls_with_metadata]
476
+ if self.urn_uuid is not None:
477
+ json['urnUuid'] = self.urn_uuid
478
+ if self.key is not None:
479
+ json['key'] = self.key
480
+ if self.value is not None:
481
+ json['value'] = self.value
482
+ if self.ignore_if_present is not None:
483
+ json['ignoreIfPresent'] = self.ignore_if_present
484
+ if self.worklet_ordinal is not None:
485
+ json['workletOrdinal'] = self.worklet_ordinal
486
+ if self.worklet_target_id is not None:
487
+ json['workletTargetId'] = self.worklet_target_id.to_json()
488
+ if self.with_lock is not None:
489
+ json['withLock'] = self.with_lock
490
+ if self.batch_update_id is not None:
491
+ json['batchUpdateId'] = self.batch_update_id
492
+ if self.batch_size is not None:
493
+ json['batchSize'] = self.batch_size
494
+ return json
495
+
496
+ @classmethod
497
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageAccessParams:
498
+ return cls(
499
+ script_source_url=str(json['scriptSourceUrl']) if json.get('scriptSourceUrl', None) is not None else None,
500
+ data_origin=str(json['dataOrigin']) if json.get('dataOrigin', None) is not None else None,
501
+ operation_name=str(json['operationName']) if json.get('operationName', None) is not None else None,
502
+ operation_id=str(json['operationId']) if json.get('operationId', None) is not None else None,
503
+ keep_alive=bool(json['keepAlive']) if json.get('keepAlive', None) is not None else None,
504
+ private_aggregation_config=SharedStoragePrivateAggregationConfig.from_json(json['privateAggregationConfig']) if json.get('privateAggregationConfig', None) is not None else None,
505
+ serialized_data=str(json['serializedData']) if json.get('serializedData', None) is not None else None,
506
+ urls_with_metadata=[SharedStorageUrlWithMetadata.from_json(i) for i in json['urlsWithMetadata']] if json.get('urlsWithMetadata', None) is not None else None,
507
+ urn_uuid=str(json['urnUuid']) if json.get('urnUuid', None) is not None else None,
508
+ key=str(json['key']) if json.get('key', None) is not None else None,
509
+ value=str(json['value']) if json.get('value', None) is not None else None,
510
+ ignore_if_present=bool(json['ignoreIfPresent']) if json.get('ignoreIfPresent', None) is not None else None,
511
+ worklet_ordinal=int(json['workletOrdinal']) if json.get('workletOrdinal', None) is not None else None,
512
+ worklet_target_id=target.TargetID.from_json(json['workletTargetId']) if json.get('workletTargetId', None) is not None else None,
513
+ with_lock=str(json['withLock']) if json.get('withLock', None) is not None else None,
514
+ batch_update_id=str(json['batchUpdateId']) if json.get('batchUpdateId', None) is not None else None,
515
+ batch_size=int(json['batchSize']) if json.get('batchSize', None) is not None else None,
516
+ )
517
+
518
+
519
+ class StorageBucketsDurability(enum.Enum):
520
+ RELAXED = "relaxed"
521
+ STRICT = "strict"
522
+
523
+ def to_json(self) -> str:
524
+ return self.value
525
+
526
+ @classmethod
527
+ def from_json(cls, json: str) -> StorageBucketsDurability:
528
+ return cls(json)
529
+
530
+
531
+ @dataclass
532
+ class StorageBucket:
533
+ storage_key: SerializedStorageKey
534
+
535
+ #: If not specified, it is the default bucket of the storageKey.
536
+ name: typing.Optional[str] = None
537
+
538
+ def to_json(self) -> T_JSON_DICT:
539
+ json: T_JSON_DICT = dict()
540
+ json['storageKey'] = self.storage_key.to_json()
541
+ if self.name is not None:
542
+ json['name'] = self.name
543
+ return json
544
+
545
+ @classmethod
546
+ def from_json(cls, json: T_JSON_DICT) -> StorageBucket:
547
+ return cls(
548
+ storage_key=SerializedStorageKey.from_json(json['storageKey']),
549
+ name=str(json['name']) if json.get('name', None) is not None else None,
550
+ )
551
+
552
+
553
+ @dataclass
554
+ class StorageBucketInfo:
555
+ bucket: StorageBucket
556
+
557
+ id_: str
558
+
559
+ expiration: network.TimeSinceEpoch
560
+
561
+ #: Storage quota (bytes).
562
+ quota: float
563
+
564
+ persistent: bool
565
+
566
+ durability: StorageBucketsDurability
567
+
568
+ def to_json(self) -> T_JSON_DICT:
569
+ json: T_JSON_DICT = dict()
570
+ json['bucket'] = self.bucket.to_json()
571
+ json['id'] = self.id_
572
+ json['expiration'] = self.expiration.to_json()
573
+ json['quota'] = self.quota
574
+ json['persistent'] = self.persistent
575
+ json['durability'] = self.durability.to_json()
576
+ return json
577
+
578
+ @classmethod
579
+ def from_json(cls, json: T_JSON_DICT) -> StorageBucketInfo:
580
+ return cls(
581
+ bucket=StorageBucket.from_json(json['bucket']),
582
+ id_=str(json['id']),
583
+ expiration=network.TimeSinceEpoch.from_json(json['expiration']),
584
+ quota=float(json['quota']),
585
+ persistent=bool(json['persistent']),
586
+ durability=StorageBucketsDurability.from_json(json['durability']),
587
+ )
588
+
589
+
590
+ @dataclass
591
+ class RelatedWebsiteSet:
592
+ '''
593
+ A single Related Website Set object.
594
+ '''
595
+ #: The primary site of this set, along with the ccTLDs if there is any.
596
+ primary_sites: typing.List[str]
597
+
598
+ #: The associated sites of this set, along with the ccTLDs if there is any.
599
+ associated_sites: typing.List[str]
600
+
601
+ #: The service sites of this set, along with the ccTLDs if there is any.
602
+ service_sites: typing.List[str]
603
+
604
+ def to_json(self) -> T_JSON_DICT:
605
+ json: T_JSON_DICT = dict()
606
+ json['primarySites'] = [i for i in self.primary_sites]
607
+ json['associatedSites'] = [i for i in self.associated_sites]
608
+ json['serviceSites'] = [i for i in self.service_sites]
609
+ return json
610
+
611
+ @classmethod
612
+ def from_json(cls, json: T_JSON_DICT) -> RelatedWebsiteSet:
613
+ return cls(
614
+ primary_sites=[str(i) for i in json['primarySites']],
615
+ associated_sites=[str(i) for i in json['associatedSites']],
616
+ service_sites=[str(i) for i in json['serviceSites']],
617
+ )
618
+
619
+
620
+ @deprecated(version="1.3")
621
+ def get_storage_key_for_frame(
622
+ frame_id: page.FrameId
623
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SerializedStorageKey]:
624
+ '''
625
+ Returns a storage key given a frame id.
626
+ Deprecated. Please use Storage.getStorageKey instead.
627
+
628
+ .. deprecated:: 1.3
629
+
630
+ :param frame_id:
631
+ :returns:
632
+ '''
633
+ params: T_JSON_DICT = dict()
634
+ params['frameId'] = frame_id.to_json()
635
+ cmd_dict: T_JSON_DICT = {
636
+ 'method': 'Storage.getStorageKeyForFrame',
637
+ 'params': params,
638
+ }
639
+ json = yield cmd_dict
640
+ return SerializedStorageKey.from_json(json['storageKey'])
641
+
642
+
643
+ def get_storage_key(
644
+ frame_id: typing.Optional[page.FrameId] = None
645
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SerializedStorageKey]:
646
+ '''
647
+ Returns storage key for the given frame. If no frame ID is provided,
648
+ the storage key of the target executing this command is returned.
649
+
650
+ **EXPERIMENTAL**
651
+
652
+ :param frame_id: *(Optional)*
653
+ :returns:
654
+ '''
655
+ params: T_JSON_DICT = dict()
656
+ if frame_id is not None:
657
+ params['frameId'] = frame_id.to_json()
658
+ cmd_dict: T_JSON_DICT = {
659
+ 'method': 'Storage.getStorageKey',
660
+ 'params': params,
661
+ }
662
+ json = yield cmd_dict
663
+ return SerializedStorageKey.from_json(json['storageKey'])
664
+
665
+
666
+ def clear_data_for_origin(
667
+ origin: str,
668
+ storage_types: str
669
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
670
+ '''
671
+ Clears storage for origin.
672
+
673
+ :param origin: Security origin.
674
+ :param storage_types: Comma separated list of StorageType to clear.
675
+ '''
676
+ params: T_JSON_DICT = dict()
677
+ params['origin'] = origin
678
+ params['storageTypes'] = storage_types
679
+ cmd_dict: T_JSON_DICT = {
680
+ 'method': 'Storage.clearDataForOrigin',
681
+ 'params': params,
682
+ }
683
+ json = yield cmd_dict
684
+
685
+
686
+ def clear_data_for_storage_key(
687
+ storage_key: str,
688
+ storage_types: str
689
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
690
+ '''
691
+ Clears storage for storage key.
692
+
693
+ :param storage_key: Storage key.
694
+ :param storage_types: Comma separated list of StorageType to clear.
695
+ '''
696
+ params: T_JSON_DICT = dict()
697
+ params['storageKey'] = storage_key
698
+ params['storageTypes'] = storage_types
699
+ cmd_dict: T_JSON_DICT = {
700
+ 'method': 'Storage.clearDataForStorageKey',
701
+ 'params': params,
702
+ }
703
+ json = yield cmd_dict
704
+
705
+
706
+ def get_cookies(
707
+ browser_context_id: typing.Optional[browser.BrowserContextID] = None
708
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[network.Cookie]]:
709
+ '''
710
+ Returns all browser cookies.
711
+
712
+ :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint.
713
+ :returns: Array of cookie objects.
714
+ '''
715
+ params: T_JSON_DICT = dict()
716
+ if browser_context_id is not None:
717
+ params['browserContextId'] = browser_context_id.to_json()
718
+ cmd_dict: T_JSON_DICT = {
719
+ 'method': 'Storage.getCookies',
720
+ 'params': params,
721
+ }
722
+ json = yield cmd_dict
723
+ return [network.Cookie.from_json(i) for i in json['cookies']]
724
+
725
+
726
+ def set_cookies(
727
+ cookies: typing.List[network.CookieParam],
728
+ browser_context_id: typing.Optional[browser.BrowserContextID] = None
729
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
730
+ '''
731
+ Sets given cookies.
732
+
733
+ :param cookies: Cookies to be set.
734
+ :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint.
735
+ '''
736
+ params: T_JSON_DICT = dict()
737
+ params['cookies'] = [i.to_json() for i in cookies]
738
+ if browser_context_id is not None:
739
+ params['browserContextId'] = browser_context_id.to_json()
740
+ cmd_dict: T_JSON_DICT = {
741
+ 'method': 'Storage.setCookies',
742
+ 'params': params,
743
+ }
744
+ json = yield cmd_dict
745
+
746
+
747
+ def clear_cookies(
748
+ browser_context_id: typing.Optional[browser.BrowserContextID] = None
749
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
750
+ '''
751
+ Clears cookies.
752
+
753
+ :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint.
754
+ '''
755
+ params: T_JSON_DICT = dict()
756
+ if browser_context_id is not None:
757
+ params['browserContextId'] = browser_context_id.to_json()
758
+ cmd_dict: T_JSON_DICT = {
759
+ 'method': 'Storage.clearCookies',
760
+ 'params': params,
761
+ }
762
+ json = yield cmd_dict
763
+
764
+
765
+ def get_usage_and_quota(
766
+ origin: str
767
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[float, float, bool, typing.List[UsageForType]]]:
768
+ '''
769
+ Returns usage and quota in bytes.
770
+
771
+ :param origin: Security origin.
772
+ :returns: A tuple with the following items:
773
+
774
+ 0. **usage** - Storage usage (bytes).
775
+ 1. **quota** - Storage quota (bytes).
776
+ 2. **overrideActive** - Whether or not the origin has an active storage quota override
777
+ 3. **usageBreakdown** - Storage usage per type (bytes).
778
+ '''
779
+ params: T_JSON_DICT = dict()
780
+ params['origin'] = origin
781
+ cmd_dict: T_JSON_DICT = {
782
+ 'method': 'Storage.getUsageAndQuota',
783
+ 'params': params,
784
+ }
785
+ json = yield cmd_dict
786
+ return (
787
+ float(json['usage']),
788
+ float(json['quota']),
789
+ bool(json['overrideActive']),
790
+ [UsageForType.from_json(i) for i in json['usageBreakdown']]
791
+ )
792
+
793
+
794
+ def override_quota_for_origin(
795
+ origin: str,
796
+ quota_size: typing.Optional[float] = None
797
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
798
+ '''
799
+ Override quota for the specified origin
800
+
801
+ **EXPERIMENTAL**
802
+
803
+ :param origin: Security origin.
804
+ :param quota_size: *(Optional)* The quota size (in bytes) to override the original quota with. If this is called multiple times, the overridden quota will be equal to the quotaSize provided in the final call. If this is called without specifying a quotaSize, the quota will be reset to the default value for the specified origin. If this is called multiple times with different origins, the override will be maintained for each origin until it is disabled (called without a quotaSize).
805
+ '''
806
+ params: T_JSON_DICT = dict()
807
+ params['origin'] = origin
808
+ if quota_size is not None:
809
+ params['quotaSize'] = quota_size
810
+ cmd_dict: T_JSON_DICT = {
811
+ 'method': 'Storage.overrideQuotaForOrigin',
812
+ 'params': params,
813
+ }
814
+ json = yield cmd_dict
815
+
816
+
817
+ def track_cache_storage_for_origin(
818
+ origin: str
819
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
820
+ '''
821
+ Registers origin to be notified when an update occurs to its cache storage list.
822
+
823
+ :param origin: Security origin.
824
+ '''
825
+ params: T_JSON_DICT = dict()
826
+ params['origin'] = origin
827
+ cmd_dict: T_JSON_DICT = {
828
+ 'method': 'Storage.trackCacheStorageForOrigin',
829
+ 'params': params,
830
+ }
831
+ json = yield cmd_dict
832
+
833
+
834
+ def track_cache_storage_for_storage_key(
835
+ storage_key: str
836
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
837
+ '''
838
+ Registers storage key to be notified when an update occurs to its cache storage list.
839
+
840
+ :param storage_key: Storage key.
841
+ '''
842
+ params: T_JSON_DICT = dict()
843
+ params['storageKey'] = storage_key
844
+ cmd_dict: T_JSON_DICT = {
845
+ 'method': 'Storage.trackCacheStorageForStorageKey',
846
+ 'params': params,
847
+ }
848
+ json = yield cmd_dict
849
+
850
+
851
+ def track_indexed_db_for_origin(
852
+ origin: str
853
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
854
+ '''
855
+ Registers origin to be notified when an update occurs to its IndexedDB.
856
+
857
+ :param origin: Security origin.
858
+ '''
859
+ params: T_JSON_DICT = dict()
860
+ params['origin'] = origin
861
+ cmd_dict: T_JSON_DICT = {
862
+ 'method': 'Storage.trackIndexedDBForOrigin',
863
+ 'params': params,
864
+ }
865
+ json = yield cmd_dict
866
+
867
+
868
+ def track_indexed_db_for_storage_key(
869
+ storage_key: str
870
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
871
+ '''
872
+ Registers storage key to be notified when an update occurs to its IndexedDB.
873
+
874
+ :param storage_key: Storage key.
875
+ '''
876
+ params: T_JSON_DICT = dict()
877
+ params['storageKey'] = storage_key
878
+ cmd_dict: T_JSON_DICT = {
879
+ 'method': 'Storage.trackIndexedDBForStorageKey',
880
+ 'params': params,
881
+ }
882
+ json = yield cmd_dict
883
+
884
+
885
+ def untrack_cache_storage_for_origin(
886
+ origin: str
887
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
888
+ '''
889
+ Unregisters origin from receiving notifications for cache storage.
890
+
891
+ :param origin: Security origin.
892
+ '''
893
+ params: T_JSON_DICT = dict()
894
+ params['origin'] = origin
895
+ cmd_dict: T_JSON_DICT = {
896
+ 'method': 'Storage.untrackCacheStorageForOrigin',
897
+ 'params': params,
898
+ }
899
+ json = yield cmd_dict
900
+
901
+
902
+ def untrack_cache_storage_for_storage_key(
903
+ storage_key: str
904
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
905
+ '''
906
+ Unregisters storage key from receiving notifications for cache storage.
907
+
908
+ :param storage_key: Storage key.
909
+ '''
910
+ params: T_JSON_DICT = dict()
911
+ params['storageKey'] = storage_key
912
+ cmd_dict: T_JSON_DICT = {
913
+ 'method': 'Storage.untrackCacheStorageForStorageKey',
914
+ 'params': params,
915
+ }
916
+ json = yield cmd_dict
917
+
918
+
919
+ def untrack_indexed_db_for_origin(
920
+ origin: str
921
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
922
+ '''
923
+ Unregisters origin from receiving notifications for IndexedDB.
924
+
925
+ :param origin: Security origin.
926
+ '''
927
+ params: T_JSON_DICT = dict()
928
+ params['origin'] = origin
929
+ cmd_dict: T_JSON_DICT = {
930
+ 'method': 'Storage.untrackIndexedDBForOrigin',
931
+ 'params': params,
932
+ }
933
+ json = yield cmd_dict
934
+
935
+
936
+ def untrack_indexed_db_for_storage_key(
937
+ storage_key: str
938
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
939
+ '''
940
+ Unregisters storage key from receiving notifications for IndexedDB.
941
+
942
+ :param storage_key: Storage key.
943
+ '''
944
+ params: T_JSON_DICT = dict()
945
+ params['storageKey'] = storage_key
946
+ cmd_dict: T_JSON_DICT = {
947
+ 'method': 'Storage.untrackIndexedDBForStorageKey',
948
+ 'params': params,
949
+ }
950
+ json = yield cmd_dict
951
+
952
+
953
+ def get_trust_tokens() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[TrustTokens]]:
954
+ '''
955
+ Returns the number of stored Trust Tokens per issuer for the
956
+ current browsing context.
957
+
958
+ **EXPERIMENTAL**
959
+
960
+ :returns:
961
+ '''
962
+ cmd_dict: T_JSON_DICT = {
963
+ 'method': 'Storage.getTrustTokens',
964
+ }
965
+ json = yield cmd_dict
966
+ return [TrustTokens.from_json(i) for i in json['tokens']]
967
+
968
+
969
+ def clear_trust_tokens(
970
+ issuer_origin: str
971
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]:
972
+ '''
973
+ Removes all Trust Tokens issued by the provided issuerOrigin.
974
+ Leaves other stored data, including the issuer's Redemption Records, intact.
975
+
976
+ **EXPERIMENTAL**
977
+
978
+ :param issuer_origin:
979
+ :returns: True if any tokens were deleted, false otherwise.
980
+ '''
981
+ params: T_JSON_DICT = dict()
982
+ params['issuerOrigin'] = issuer_origin
983
+ cmd_dict: T_JSON_DICT = {
984
+ 'method': 'Storage.clearTrustTokens',
985
+ 'params': params,
986
+ }
987
+ json = yield cmd_dict
988
+ return bool(json['didDeleteTokens'])
989
+
990
+
991
+ def get_interest_group_details(
992
+ owner_origin: str,
993
+ name: str
994
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]:
995
+ '''
996
+ Gets details for a named interest group.
997
+
998
+ **EXPERIMENTAL**
999
+
1000
+ :param owner_origin:
1001
+ :param name:
1002
+ :returns: This largely corresponds to: https://wicg.github.io/turtledove/#dictdef-generatebidinterestgroup but has absolute expirationTime instead of relative lifetimeMs and also adds joiningOrigin.
1003
+ '''
1004
+ params: T_JSON_DICT = dict()
1005
+ params['ownerOrigin'] = owner_origin
1006
+ params['name'] = name
1007
+ cmd_dict: T_JSON_DICT = {
1008
+ 'method': 'Storage.getInterestGroupDetails',
1009
+ 'params': params,
1010
+ }
1011
+ json = yield cmd_dict
1012
+ return dict(json['details'])
1013
+
1014
+
1015
+ def set_interest_group_tracking(
1016
+ enable: bool
1017
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1018
+ '''
1019
+ Enables/Disables issuing of interestGroupAccessed events.
1020
+
1021
+ **EXPERIMENTAL**
1022
+
1023
+ :param enable:
1024
+ '''
1025
+ params: T_JSON_DICT = dict()
1026
+ params['enable'] = enable
1027
+ cmd_dict: T_JSON_DICT = {
1028
+ 'method': 'Storage.setInterestGroupTracking',
1029
+ 'params': params,
1030
+ }
1031
+ json = yield cmd_dict
1032
+
1033
+
1034
+ def set_interest_group_auction_tracking(
1035
+ enable: bool
1036
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1037
+ '''
1038
+ Enables/Disables issuing of interestGroupAuctionEventOccurred and
1039
+ interestGroupAuctionNetworkRequestCreated.
1040
+
1041
+ **EXPERIMENTAL**
1042
+
1043
+ :param enable:
1044
+ '''
1045
+ params: T_JSON_DICT = dict()
1046
+ params['enable'] = enable
1047
+ cmd_dict: T_JSON_DICT = {
1048
+ 'method': 'Storage.setInterestGroupAuctionTracking',
1049
+ 'params': params,
1050
+ }
1051
+ json = yield cmd_dict
1052
+
1053
+
1054
+ def get_shared_storage_metadata(
1055
+ owner_origin: str
1056
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SharedStorageMetadata]:
1057
+ '''
1058
+ Gets metadata for an origin's shared storage.
1059
+
1060
+ **EXPERIMENTAL**
1061
+
1062
+ :param owner_origin:
1063
+ :returns:
1064
+ '''
1065
+ params: T_JSON_DICT = dict()
1066
+ params['ownerOrigin'] = owner_origin
1067
+ cmd_dict: T_JSON_DICT = {
1068
+ 'method': 'Storage.getSharedStorageMetadata',
1069
+ 'params': params,
1070
+ }
1071
+ json = yield cmd_dict
1072
+ return SharedStorageMetadata.from_json(json['metadata'])
1073
+
1074
+
1075
+ def get_shared_storage_entries(
1076
+ owner_origin: str
1077
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[SharedStorageEntry]]:
1078
+ '''
1079
+ Gets the entries in an given origin's shared storage.
1080
+
1081
+ **EXPERIMENTAL**
1082
+
1083
+ :param owner_origin:
1084
+ :returns:
1085
+ '''
1086
+ params: T_JSON_DICT = dict()
1087
+ params['ownerOrigin'] = owner_origin
1088
+ cmd_dict: T_JSON_DICT = {
1089
+ 'method': 'Storage.getSharedStorageEntries',
1090
+ 'params': params,
1091
+ }
1092
+ json = yield cmd_dict
1093
+ return [SharedStorageEntry.from_json(i) for i in json['entries']]
1094
+
1095
+
1096
+ def set_shared_storage_entry(
1097
+ owner_origin: str,
1098
+ key: str,
1099
+ value: str,
1100
+ ignore_if_present: typing.Optional[bool] = None
1101
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1102
+ '''
1103
+ Sets entry with ``key`` and ``value`` for a given origin's shared storage.
1104
+
1105
+ **EXPERIMENTAL**
1106
+
1107
+ :param owner_origin:
1108
+ :param key:
1109
+ :param value:
1110
+ :param ignore_if_present: *(Optional)* If ```ignoreIfPresent```` is included and true, then only sets the entry if ````key``` doesn't already exist.
1111
+ '''
1112
+ params: T_JSON_DICT = dict()
1113
+ params['ownerOrigin'] = owner_origin
1114
+ params['key'] = key
1115
+ params['value'] = value
1116
+ if ignore_if_present is not None:
1117
+ params['ignoreIfPresent'] = ignore_if_present
1118
+ cmd_dict: T_JSON_DICT = {
1119
+ 'method': 'Storage.setSharedStorageEntry',
1120
+ 'params': params,
1121
+ }
1122
+ json = yield cmd_dict
1123
+
1124
+
1125
+ def delete_shared_storage_entry(
1126
+ owner_origin: str,
1127
+ key: str
1128
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1129
+ '''
1130
+ Deletes entry for ``key`` (if it exists) for a given origin's shared storage.
1131
+
1132
+ **EXPERIMENTAL**
1133
+
1134
+ :param owner_origin:
1135
+ :param key:
1136
+ '''
1137
+ params: T_JSON_DICT = dict()
1138
+ params['ownerOrigin'] = owner_origin
1139
+ params['key'] = key
1140
+ cmd_dict: T_JSON_DICT = {
1141
+ 'method': 'Storage.deleteSharedStorageEntry',
1142
+ 'params': params,
1143
+ }
1144
+ json = yield cmd_dict
1145
+
1146
+
1147
+ def clear_shared_storage_entries(
1148
+ owner_origin: str
1149
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1150
+ '''
1151
+ Clears all entries for a given origin's shared storage.
1152
+
1153
+ **EXPERIMENTAL**
1154
+
1155
+ :param owner_origin:
1156
+ '''
1157
+ params: T_JSON_DICT = dict()
1158
+ params['ownerOrigin'] = owner_origin
1159
+ cmd_dict: T_JSON_DICT = {
1160
+ 'method': 'Storage.clearSharedStorageEntries',
1161
+ 'params': params,
1162
+ }
1163
+ json = yield cmd_dict
1164
+
1165
+
1166
+ def reset_shared_storage_budget(
1167
+ owner_origin: str
1168
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1169
+ '''
1170
+ Resets the budget for ``ownerOrigin`` by clearing all budget withdrawals.
1171
+
1172
+ **EXPERIMENTAL**
1173
+
1174
+ :param owner_origin:
1175
+ '''
1176
+ params: T_JSON_DICT = dict()
1177
+ params['ownerOrigin'] = owner_origin
1178
+ cmd_dict: T_JSON_DICT = {
1179
+ 'method': 'Storage.resetSharedStorageBudget',
1180
+ 'params': params,
1181
+ }
1182
+ json = yield cmd_dict
1183
+
1184
+
1185
+ def set_shared_storage_tracking(
1186
+ enable: bool
1187
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1188
+ '''
1189
+ Enables/disables issuing of sharedStorageAccessed events.
1190
+
1191
+ **EXPERIMENTAL**
1192
+
1193
+ :param enable:
1194
+ '''
1195
+ params: T_JSON_DICT = dict()
1196
+ params['enable'] = enable
1197
+ cmd_dict: T_JSON_DICT = {
1198
+ 'method': 'Storage.setSharedStorageTracking',
1199
+ 'params': params,
1200
+ }
1201
+ json = yield cmd_dict
1202
+
1203
+
1204
+ def set_storage_bucket_tracking(
1205
+ storage_key: str,
1206
+ enable: bool
1207
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1208
+ '''
1209
+ Set tracking for a storage key's buckets.
1210
+
1211
+ **EXPERIMENTAL**
1212
+
1213
+ :param storage_key:
1214
+ :param enable:
1215
+ '''
1216
+ params: T_JSON_DICT = dict()
1217
+ params['storageKey'] = storage_key
1218
+ params['enable'] = enable
1219
+ cmd_dict: T_JSON_DICT = {
1220
+ 'method': 'Storage.setStorageBucketTracking',
1221
+ 'params': params,
1222
+ }
1223
+ json = yield cmd_dict
1224
+
1225
+
1226
+ def delete_storage_bucket(
1227
+ bucket: StorageBucket
1228
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1229
+ '''
1230
+ Deletes the Storage Bucket with the given storage key and bucket name.
1231
+
1232
+ **EXPERIMENTAL**
1233
+
1234
+ :param bucket:
1235
+ '''
1236
+ params: T_JSON_DICT = dict()
1237
+ params['bucket'] = bucket.to_json()
1238
+ cmd_dict: T_JSON_DICT = {
1239
+ 'method': 'Storage.deleteStorageBucket',
1240
+ 'params': params,
1241
+ }
1242
+ json = yield cmd_dict
1243
+
1244
+
1245
+ def run_bounce_tracking_mitigations() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]:
1246
+ '''
1247
+ Deletes state for sites identified as potential bounce trackers, immediately.
1248
+
1249
+ **EXPERIMENTAL**
1250
+
1251
+ :returns:
1252
+ '''
1253
+ cmd_dict: T_JSON_DICT = {
1254
+ 'method': 'Storage.runBounceTrackingMitigations',
1255
+ }
1256
+ json = yield cmd_dict
1257
+ return [str(i) for i in json['deletedSites']]
1258
+
1259
+
1260
+ def get_related_website_sets() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[RelatedWebsiteSet]]:
1261
+ '''
1262
+ Returns the effective Related Website Sets in use by this profile for the browser
1263
+ session. The effective Related Website Sets will not change during a browser session.
1264
+
1265
+ **EXPERIMENTAL**
1266
+
1267
+ :returns:
1268
+ '''
1269
+ cmd_dict: T_JSON_DICT = {
1270
+ 'method': 'Storage.getRelatedWebsiteSets',
1271
+ }
1272
+ json = yield cmd_dict
1273
+ return [RelatedWebsiteSet.from_json(i) for i in json['sets']]
1274
+
1275
+
1276
+ def set_protected_audience_k_anonymity(
1277
+ owner: str,
1278
+ name: str,
1279
+ hashes: typing.List[str]
1280
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1281
+ '''
1282
+ :param owner:
1283
+ :param name:
1284
+ :param hashes:
1285
+ '''
1286
+ params: T_JSON_DICT = dict()
1287
+ params['owner'] = owner
1288
+ params['name'] = name
1289
+ params['hashes'] = [i for i in hashes]
1290
+ cmd_dict: T_JSON_DICT = {
1291
+ 'method': 'Storage.setProtectedAudienceKAnonymity',
1292
+ 'params': params,
1293
+ }
1294
+ json = yield cmd_dict
1295
+
1296
+
1297
+ @event_class('Storage.cacheStorageContentUpdated')
1298
+ @dataclass
1299
+ class CacheStorageContentUpdated:
1300
+ '''
1301
+ A cache's contents have been modified.
1302
+ '''
1303
+ #: Origin to update.
1304
+ origin: str
1305
+ #: Storage key to update.
1306
+ storage_key: str
1307
+ #: Storage bucket to update.
1308
+ bucket_id: str
1309
+ #: Name of cache in origin.
1310
+ cache_name: str
1311
+
1312
+ @classmethod
1313
+ def from_json(cls, json: T_JSON_DICT) -> CacheStorageContentUpdated:
1314
+ return cls(
1315
+ origin=str(json['origin']),
1316
+ storage_key=str(json['storageKey']),
1317
+ bucket_id=str(json['bucketId']),
1318
+ cache_name=str(json['cacheName'])
1319
+ )
1320
+
1321
+
1322
+ @event_class('Storage.cacheStorageListUpdated')
1323
+ @dataclass
1324
+ class CacheStorageListUpdated:
1325
+ '''
1326
+ A cache has been added/deleted.
1327
+ '''
1328
+ #: Origin to update.
1329
+ origin: str
1330
+ #: Storage key to update.
1331
+ storage_key: str
1332
+ #: Storage bucket to update.
1333
+ bucket_id: str
1334
+
1335
+ @classmethod
1336
+ def from_json(cls, json: T_JSON_DICT) -> CacheStorageListUpdated:
1337
+ return cls(
1338
+ origin=str(json['origin']),
1339
+ storage_key=str(json['storageKey']),
1340
+ bucket_id=str(json['bucketId'])
1341
+ )
1342
+
1343
+
1344
+ @event_class('Storage.indexedDBContentUpdated')
1345
+ @dataclass
1346
+ class IndexedDBContentUpdated:
1347
+ '''
1348
+ The origin's IndexedDB object store has been modified.
1349
+ '''
1350
+ #: Origin to update.
1351
+ origin: str
1352
+ #: Storage key to update.
1353
+ storage_key: str
1354
+ #: Storage bucket to update.
1355
+ bucket_id: str
1356
+ #: Database to update.
1357
+ database_name: str
1358
+ #: ObjectStore to update.
1359
+ object_store_name: str
1360
+
1361
+ @classmethod
1362
+ def from_json(cls, json: T_JSON_DICT) -> IndexedDBContentUpdated:
1363
+ return cls(
1364
+ origin=str(json['origin']),
1365
+ storage_key=str(json['storageKey']),
1366
+ bucket_id=str(json['bucketId']),
1367
+ database_name=str(json['databaseName']),
1368
+ object_store_name=str(json['objectStoreName'])
1369
+ )
1370
+
1371
+
1372
+ @event_class('Storage.indexedDBListUpdated')
1373
+ @dataclass
1374
+ class IndexedDBListUpdated:
1375
+ '''
1376
+ The origin's IndexedDB database list has been modified.
1377
+ '''
1378
+ #: Origin to update.
1379
+ origin: str
1380
+ #: Storage key to update.
1381
+ storage_key: str
1382
+ #: Storage bucket to update.
1383
+ bucket_id: str
1384
+
1385
+ @classmethod
1386
+ def from_json(cls, json: T_JSON_DICT) -> IndexedDBListUpdated:
1387
+ return cls(
1388
+ origin=str(json['origin']),
1389
+ storage_key=str(json['storageKey']),
1390
+ bucket_id=str(json['bucketId'])
1391
+ )
1392
+
1393
+
1394
+ @event_class('Storage.interestGroupAccessed')
1395
+ @dataclass
1396
+ class InterestGroupAccessed:
1397
+ '''
1398
+ One of the interest groups was accessed. Note that these events are global
1399
+ to all targets sharing an interest group store.
1400
+ '''
1401
+ access_time: network.TimeSinceEpoch
1402
+ type_: InterestGroupAccessType
1403
+ owner_origin: str
1404
+ name: str
1405
+ #: For topLevelBid/topLevelAdditionalBid, and when appropriate,
1406
+ #: win and additionalBidWin
1407
+ component_seller_origin: typing.Optional[str]
1408
+ #: For bid or somethingBid event, if done locally and not on a server.
1409
+ bid: typing.Optional[float]
1410
+ bid_currency: typing.Optional[str]
1411
+ #: For non-global events --- links to interestGroupAuctionEvent
1412
+ unique_auction_id: typing.Optional[InterestGroupAuctionId]
1413
+
1414
+ @classmethod
1415
+ def from_json(cls, json: T_JSON_DICT) -> InterestGroupAccessed:
1416
+ return cls(
1417
+ access_time=network.TimeSinceEpoch.from_json(json['accessTime']),
1418
+ type_=InterestGroupAccessType.from_json(json['type']),
1419
+ owner_origin=str(json['ownerOrigin']),
1420
+ name=str(json['name']),
1421
+ component_seller_origin=str(json['componentSellerOrigin']) if json.get('componentSellerOrigin', None) is not None else None,
1422
+ bid=float(json['bid']) if json.get('bid', None) is not None else None,
1423
+ bid_currency=str(json['bidCurrency']) if json.get('bidCurrency', None) is not None else None,
1424
+ unique_auction_id=InterestGroupAuctionId.from_json(json['uniqueAuctionId']) if json.get('uniqueAuctionId', None) is not None else None
1425
+ )
1426
+
1427
+
1428
+ @event_class('Storage.interestGroupAuctionEventOccurred')
1429
+ @dataclass
1430
+ class InterestGroupAuctionEventOccurred:
1431
+ '''
1432
+ An auction involving interest groups is taking place. These events are
1433
+ target-specific.
1434
+ '''
1435
+ event_time: network.TimeSinceEpoch
1436
+ type_: InterestGroupAuctionEventType
1437
+ unique_auction_id: InterestGroupAuctionId
1438
+ #: Set for child auctions.
1439
+ parent_auction_id: typing.Optional[InterestGroupAuctionId]
1440
+ #: Set for started and configResolved
1441
+ auction_config: typing.Optional[dict]
1442
+
1443
+ @classmethod
1444
+ def from_json(cls, json: T_JSON_DICT) -> InterestGroupAuctionEventOccurred:
1445
+ return cls(
1446
+ event_time=network.TimeSinceEpoch.from_json(json['eventTime']),
1447
+ type_=InterestGroupAuctionEventType.from_json(json['type']),
1448
+ unique_auction_id=InterestGroupAuctionId.from_json(json['uniqueAuctionId']),
1449
+ parent_auction_id=InterestGroupAuctionId.from_json(json['parentAuctionId']) if json.get('parentAuctionId', None) is not None else None,
1450
+ auction_config=dict(json['auctionConfig']) if json.get('auctionConfig', None) is not None else None
1451
+ )
1452
+
1453
+
1454
+ @event_class('Storage.interestGroupAuctionNetworkRequestCreated')
1455
+ @dataclass
1456
+ class InterestGroupAuctionNetworkRequestCreated:
1457
+ '''
1458
+ Specifies which auctions a particular network fetch may be related to, and
1459
+ in what role. Note that it is not ordered with respect to
1460
+ Network.requestWillBeSent (but will happen before loadingFinished
1461
+ loadingFailed).
1462
+ '''
1463
+ type_: InterestGroupAuctionFetchType
1464
+ request_id: network.RequestId
1465
+ #: This is the set of the auctions using the worklet that issued this
1466
+ #: request. In the case of trusted signals, it's possible that only some of
1467
+ #: them actually care about the keys being queried.
1468
+ auctions: typing.List[InterestGroupAuctionId]
1469
+
1470
+ @classmethod
1471
+ def from_json(cls, json: T_JSON_DICT) -> InterestGroupAuctionNetworkRequestCreated:
1472
+ return cls(
1473
+ type_=InterestGroupAuctionFetchType.from_json(json['type']),
1474
+ request_id=network.RequestId.from_json(json['requestId']),
1475
+ auctions=[InterestGroupAuctionId.from_json(i) for i in json['auctions']]
1476
+ )
1477
+
1478
+
1479
+ @event_class('Storage.sharedStorageAccessed')
1480
+ @dataclass
1481
+ class SharedStorageAccessed:
1482
+ '''
1483
+ Shared storage was accessed by the associated page.
1484
+ The following parameters are included in all events.
1485
+ '''
1486
+ #: Time of the access.
1487
+ access_time: network.TimeSinceEpoch
1488
+ #: Enum value indicating the access scope.
1489
+ scope: SharedStorageAccessScope
1490
+ #: Enum value indicating the Shared Storage API method invoked.
1491
+ method: SharedStorageAccessMethod
1492
+ #: DevTools Frame Token for the primary frame tree's root.
1493
+ main_frame_id: page.FrameId
1494
+ #: Serialization of the origin owning the Shared Storage data.
1495
+ owner_origin: str
1496
+ #: Serialization of the site owning the Shared Storage data.
1497
+ owner_site: str
1498
+ #: The sub-parameters wrapped by ``params`` are all optional and their
1499
+ #: presence/absence depends on ``type``.
1500
+ params: SharedStorageAccessParams
1501
+
1502
+ @classmethod
1503
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageAccessed:
1504
+ return cls(
1505
+ access_time=network.TimeSinceEpoch.from_json(json['accessTime']),
1506
+ scope=SharedStorageAccessScope.from_json(json['scope']),
1507
+ method=SharedStorageAccessMethod.from_json(json['method']),
1508
+ main_frame_id=page.FrameId.from_json(json['mainFrameId']),
1509
+ owner_origin=str(json['ownerOrigin']),
1510
+ owner_site=str(json['ownerSite']),
1511
+ params=SharedStorageAccessParams.from_json(json['params'])
1512
+ )
1513
+
1514
+
1515
+ @event_class('Storage.sharedStorageWorkletOperationExecutionFinished')
1516
+ @dataclass
1517
+ class SharedStorageWorkletOperationExecutionFinished:
1518
+ '''
1519
+ A shared storage run or selectURL operation finished its execution.
1520
+ The following parameters are included in all events.
1521
+ '''
1522
+ #: Time that the operation finished.
1523
+ finished_time: network.TimeSinceEpoch
1524
+ #: Time, in microseconds, from start of shared storage JS API call until
1525
+ #: end of operation execution in the worklet.
1526
+ execution_time: int
1527
+ #: Enum value indicating the Shared Storage API method invoked.
1528
+ method: SharedStorageAccessMethod
1529
+ #: ID of the operation call.
1530
+ operation_id: str
1531
+ #: Hex representation of the DevTools token used as the TargetID for the
1532
+ #: associated shared storage worklet.
1533
+ worklet_target_id: target.TargetID
1534
+ #: DevTools Frame Token for the primary frame tree's root.
1535
+ main_frame_id: page.FrameId
1536
+ #: Serialization of the origin owning the Shared Storage data.
1537
+ owner_origin: str
1538
+
1539
+ @classmethod
1540
+ def from_json(cls, json: T_JSON_DICT) -> SharedStorageWorkletOperationExecutionFinished:
1541
+ return cls(
1542
+ finished_time=network.TimeSinceEpoch.from_json(json['finishedTime']),
1543
+ execution_time=int(json['executionTime']),
1544
+ method=SharedStorageAccessMethod.from_json(json['method']),
1545
+ operation_id=str(json['operationId']),
1546
+ worklet_target_id=target.TargetID.from_json(json['workletTargetId']),
1547
+ main_frame_id=page.FrameId.from_json(json['mainFrameId']),
1548
+ owner_origin=str(json['ownerOrigin'])
1549
+ )
1550
+
1551
+
1552
+ @event_class('Storage.storageBucketCreatedOrUpdated')
1553
+ @dataclass
1554
+ class StorageBucketCreatedOrUpdated:
1555
+ bucket_info: StorageBucketInfo
1556
+
1557
+ @classmethod
1558
+ def from_json(cls, json: T_JSON_DICT) -> StorageBucketCreatedOrUpdated:
1559
+ return cls(
1560
+ bucket_info=StorageBucketInfo.from_json(json['bucketInfo'])
1561
+ )
1562
+
1563
+
1564
+ @event_class('Storage.storageBucketDeleted')
1565
+ @dataclass
1566
+ class StorageBucketDeleted:
1567
+ bucket_id: str
1568
+
1569
+ @classmethod
1570
+ def from_json(cls, json: T_JSON_DICT) -> StorageBucketDeleted:
1571
+ return cls(
1572
+ bucket_id=str(json['bucketId'])
1573
+ )