diff --git a/pycdp/cdp/audits.py b/pycdp/cdp/audits.py index 4c71d3a..105da2a 100644 --- a/pycdp/cdp/audits.py +++ b/pycdp/cdp/audits.py @@ -1085,7 +1085,7 @@ class FederatedAuthRequestIssueReason(enum.Enum): THIRD_PARTY_COOKIES_BLOCKED = "ThirdPartyCookiesBlocked" NOT_SIGNED_IN_WITH_IDP = "NotSignedInWithIdp" MISSING_TRANSIENT_USER_ACTIVATION = "MissingTransientUserActivation" - REPLACED_BY_ACTIVE_MODE = "ReplacedByActiveMode" + REPLACED_BY_BUTTON_MODE = "ReplacedByButtonMode" INVALID_FIELDS_SPECIFIED = "InvalidFieldsSpecified" RELYING_PARTY_ORIGIN_IS_OPAQUE = "RelyingPartyOriginIsOpaque" TYPE_NOT_MATCHING = "TypeNotMatching" diff --git a/pycdp/cdp/bluetooth_emulation.py b/pycdp/cdp/bluetooth_emulation.py new file mode 100644 index 0000000..9f36e41 --- /dev/null +++ b/pycdp/cdp/bluetooth_emulation.py @@ -0,0 +1,198 @@ +# DO NOT EDIT THIS FILE! +# +# This file is generated from the CDP specification. If you need to make +# changes, edit the generator and regenerate all of the modules. +# +# CDP domain: BluetoothEmulation (experimental) + +from __future__ import annotations +import enum +import typing +from dataclasses import dataclass +from .util import event_class, T_JSON_DICT + + +class CentralState(enum.Enum): + ''' + Indicates the various states of Central. + ''' + ABSENT = "absent" + POWERED_OFF = "powered-off" + POWERED_ON = "powered-on" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CentralState: + return cls(json) + + +@dataclass +class ManufacturerData: + ''' + Stores the manufacturer data + ''' + #: Company identifier + #: https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/company_identifiers/company_identifiers.yaml + #: https://usb.org/developers + key: int + + #: Manufacturer-specific data (Encoded as a base64 string when passed over JSON) + data: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['key'] = self.key + json['data'] = self.data + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ManufacturerData: + return cls( + key=int(json['key']), + data=str(json['data']), + ) + + +@dataclass +class ScanRecord: + ''' + Stores the byte data of the advertisement packet sent by a Bluetooth device. + ''' + name: typing.Optional[str] = None + + uuids: typing.Optional[typing.List[str]] = None + + #: Stores the external appearance description of the device. + appearance: typing.Optional[int] = None + + #: Stores the transmission power of a broadcasting device. + tx_power: typing.Optional[int] = None + + #: Key is the company identifier and the value is an array of bytes of + #: manufacturer specific data. + manufacturer_data: typing.Optional[typing.List[ManufacturerData]] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.name is not None: + json['name'] = self.name + if self.uuids is not None: + json['uuids'] = [i for i in self.uuids] + if self.appearance is not None: + json['appearance'] = self.appearance + if self.tx_power is not None: + json['txPower'] = self.tx_power + if self.manufacturer_data is not None: + json['manufacturerData'] = [i.to_json() for i in self.manufacturer_data] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ScanRecord: + return cls( + name=str(json['name']) if json.get('name', None) is not None else None, + uuids=[str(i) for i in json['uuids']] if json.get('uuids', None) is not None else None, + appearance=int(json['appearance']) if json.get('appearance', None) is not None else None, + tx_power=int(json['txPower']) if json.get('txPower', None) is not None else None, + manufacturer_data=[ManufacturerData.from_json(i) for i in json['manufacturerData']] if json.get('manufacturerData', None) is not None else None, + ) + + +@dataclass +class ScanEntry: + ''' + Stores the advertisement packet information that is sent by a Bluetooth device. + ''' + device_address: str + + rssi: int + + scan_record: ScanRecord + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['deviceAddress'] = self.device_address + json['rssi'] = self.rssi + json['scanRecord'] = self.scan_record.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ScanEntry: + return cls( + device_address=str(json['deviceAddress']), + rssi=int(json['rssi']), + scan_record=ScanRecord.from_json(json['scanRecord']), + ) + + +def enable( + state: CentralState + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + ''' + Enable the BluetoothEmulation domain. + + :param state: State of the simulated central. + ''' + params: T_JSON_DICT = dict() + params['state'] = state.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'BluetoothEmulation.enable', + 'params': params, + } + json = yield cmd_dict + + +def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + ''' + Disable the BluetoothEmulation domain. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'BluetoothEmulation.disable', + } + json = yield cmd_dict + + +def simulate_preconnected_peripheral( + address: str, + name: str, + manufacturer_data: typing.List[ManufacturerData], + known_service_uuids: typing.List[str] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + ''' + Simulates a peripheral with ``address``, ``name`` and ``knownServiceUuids`` + that has already been connected to the system. + + :param address: + :param name: + :param manufacturer_data: + :param known_service_uuids: + ''' + params: T_JSON_DICT = dict() + params['address'] = address + params['name'] = name + params['manufacturerData'] = [i.to_json() for i in manufacturer_data] + params['knownServiceUuids'] = [i for i in known_service_uuids] + cmd_dict: T_JSON_DICT = { + 'method': 'BluetoothEmulation.simulatePreconnectedPeripheral', + 'params': params, + } + json = yield cmd_dict + + +def simulate_advertisement( + entry: ScanEntry + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + ''' + Simulates an advertisement packet described in ``entry`` being received by + the central. + + :param entry: + ''' + params: T_JSON_DICT = dict() + params['entry'] = entry.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'BluetoothEmulation.simulateAdvertisement', + 'params': params, + } + json = yield cmd_dict diff --git a/pycdp/cdp/dom.py b/pycdp/cdp/dom.py index 3d701e4..b013cf8 100644 --- a/pycdp/cdp/dom.py +++ b/pycdp/cdp/dom.py @@ -99,6 +99,8 @@ class PseudoType(enum.Enum): SCROLL_MARKER = "scroll-marker" SCROLL_MARKER_GROUP = "scroll-marker-group" SCROLL_BUTTON = "scroll-button" + SCROLL_NEXT_BUTTON = "scroll-next-button" + SCROLL_PREV_BUTTON = "scroll-prev-button" SCROLLBAR = "scrollbar" SCROLLBAR_THUMB = "scrollbar-thumb" SCROLLBAR_BUTTON = "scrollbar-button" @@ -115,6 +117,8 @@ class PseudoType(enum.Enum): PLACEHOLDER = "placeholder" FILE_SELECTOR_BUTTON = "file-selector-button" DETAILS_CONTENT = "details-content" + SELECT_FALLBACK_BUTTON = "select-fallback-button" + SELECT_FALLBACK_BUTTON_TEXT = "select-fallback-button-text" PICKER = "picker" def to_json(self) -> str: diff --git a/pycdp/cdp/file_system.py b/pycdp/cdp/file_system.py new file mode 100644 index 0000000..398fac9 --- /dev/null +++ b/pycdp/cdp/file_system.py @@ -0,0 +1,115 @@ +# DO NOT EDIT THIS FILE! +# +# This file is generated from the CDP specification. If you need to make +# changes, edit the generator and regenerate all of the modules. +# +# CDP domain: FileSystem (experimental) + +from __future__ import annotations +import enum +import typing +from dataclasses import dataclass +from .util import event_class, T_JSON_DICT + +from . import network +from . import storage + + +@dataclass +class File: + name: str + + #: Timestamp + last_modified: network.TimeSinceEpoch + + #: Size in bytes + size: float + + type_: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['lastModified'] = self.last_modified.to_json() + json['size'] = self.size + json['type'] = self.type_ + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> File: + return cls( + name=str(json['name']), + last_modified=network.TimeSinceEpoch.from_json(json['lastModified']), + size=float(json['size']), + type_=str(json['type']), + ) + + +@dataclass +class Directory: + name: str + + nested_directories: typing.List[str] + + #: Files that are directly nested under this directory. + nested_files: typing.List[File] + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['nestedDirectories'] = [i for i in self.nested_directories] + json['nestedFiles'] = [i.to_json() for i in self.nested_files] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> Directory: + return cls( + name=str(json['name']), + nested_directories=[str(i) for i in json['nestedDirectories']], + nested_files=[File.from_json(i) for i in json['nestedFiles']], + ) + + +@dataclass +class BucketFileSystemLocator: + #: Storage key + storage_key: storage.SerializedStorageKey + + #: Path to the directory using each path component as an array item. + path_components: typing.List[str] + + #: Bucket name. Not passing a ``bucketName`` will retrieve the default Bucket. (https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#storage_buckets) + bucket_name: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['storageKey'] = self.storage_key.to_json() + json['pathComponents'] = [i for i in self.path_components] + if self.bucket_name is not None: + json['bucketName'] = self.bucket_name + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> BucketFileSystemLocator: + return cls( + storage_key=storage.SerializedStorageKey.from_json(json['storageKey']), + path_components=[str(i) for i in json['pathComponents']], + bucket_name=str(json['bucketName']) if json.get('bucketName', None) is not None else None, + ) + + +def get_directory( + bucket_file_system_locator: BucketFileSystemLocator + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Directory]: + ''' + :param bucket_file_system_locator: + :returns: Returns the directory object at the path. + ''' + params: T_JSON_DICT = dict() + params['bucketFileSystemLocator'] = bucket_file_system_locator.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'FileSystem.getDirectory', + 'params': params, + } + json = yield cmd_dict + return Directory.from_json(json['directory']) diff --git a/pycdp/cdp/preload.py b/pycdp/cdp/preload.py index d93059e..cff559d 100644 --- a/pycdp/cdp/preload.py +++ b/pycdp/cdp/preload.py @@ -294,7 +294,6 @@ class PrerenderFinalStatus(enum.Enum): OTHER_PRERENDERED_PAGE_ACTIVATED = "OtherPrerenderedPageActivated" V8_OPTIMIZER_DISABLED = "V8OptimizerDisabled" PRERENDER_FAILED_DURING_PREFETCH = "PrerenderFailedDuringPrefetch" - def to_json(self) -> str: return self.value diff --git a/pycdp/gen/browser_protocol.json b/pycdp/gen/browser_protocol.json index d40b824..e3059eb 100644 --- a/pycdp/gen/browser_protocol.json +++ b/pycdp/gen/browser_protocol.json @@ -1049,9 +1049,13 @@ "ExcludeSamePartyCrossPartyContext", "ExcludeDomainNonASCII", "ExcludeThirdPartyCookieBlockedInFirstPartySet", +<<<<<<< HEAD "ExcludeThirdPartyPhaseout", "ExcludePortMismatch", "ExcludeSchemeMismatch" +======= + "ExcludeThirdPartyPhaseout" +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 ] }, { @@ -1261,8 +1265,12 @@ "CorpNotSameOriginAfterDefaultedToSameOriginByCoep", "CorpNotSameOriginAfterDefaultedToSameOriginByDip", "CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip", +<<<<<<< HEAD "CorpNotSameSite", "SRIMessageSignatureMismatch" +======= + "CorpNotSameSite" +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 ] }, { @@ -1817,7 +1825,11 @@ "ThirdPartyCookiesBlocked", "NotSignedInWithIdp", "MissingTransientUserActivation", +<<<<<<< HEAD "ReplacedByActiveMode", +======= + "ReplacedByButtonMode", +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "InvalidFieldsSpecified", "RelyingPartyOriginIsOpaque", "TypeNotMatching" @@ -2792,8 +2804,11 @@ "audioCapture", "automaticFullscreen", "backgroundFetch", +<<<<<<< HEAD "backgroundSync", "cameraPanTiltZoom", +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "capturedSurfaceControl", "clipboardReadWrite", "clipboardSanitizedWrite", @@ -2816,13 +2831,17 @@ "smartCard", "speakerSelection", "storageAccess", + "speakerSelection", "topLevelStorageAccess", "videoCapture", "vr", "wakeLockScreen", "wakeLockSystem", "webAppInstallation", +<<<<<<< HEAD "webPrinting", +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "windowManagement" ] }, @@ -4928,6 +4947,7 @@ ] }, { +<<<<<<< HEAD "name": "trackComputedStyleUpdatesForNode", "description": "Starts tracking the given node for the computed style updates\nand whenever the computed style is updated for node, it queues\na `computedStyleUpdated` event with throttling.\nThere can only be 1 node tracked for computed style updates\nso passing a new node id removes tracking from the previous node.\nPass `undefined` to disable tracking.", "experimental": true, @@ -4940,6 +4960,8 @@ ] }, { +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "name": "trackComputedStyleUpdates", "description": "Starts tracking the given computed styles for updates. The specified array of properties\nreplaces the one previously specified. Pass empty array to disable tracking.\nUse takeComputedStyleUpdates to retrieve the list of nodes that had properties modified.\nThe changes to computed style properties are only tracked for nodes pushed to the front-end\nby the DOM agent. If no changes to the tracked properties occur after the node has been pushed\nto the front-end, no updates will be issued for the node.", "experimental": true, @@ -5774,7 +5796,12 @@ "first-line-inherited", "scroll-marker", "scroll-marker-group", +<<<<<<< HEAD "scroll-button", +======= + "scroll-next-button", + "scroll-prev-button", +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "scrollbar", "scrollbar-thumb", "scrollbar-button", @@ -5791,6 +5818,11 @@ "placeholder", "file-selector-button", "details-content", +<<<<<<< HEAD +======= + "select-fallback-button", + "select-fallback-button-text", +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "picker" ] }, @@ -12962,8 +12994,12 @@ "corp-not-same-origin-after-defaulted-to-same-origin-by-coep", "corp-not-same-origin-after-defaulted-to-same-origin-by-dip", "corp-not-same-origin-after-defaulted-to-same-origin-by-coep-and-dip", +<<<<<<< HEAD "corp-not-same-site", "sri-message-signature-mismatch" +======= + "corp-not-same-site" +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 ] }, { @@ -13628,6 +13664,24 @@ "Scheme" ] }, + { + "id": "CookieExemptionReason", + "description": "Types of reasons why a cookie should have been blocked by 3PCD but is exempted for the request.", + "experimental": true, + "type": "string", + "enum": [ + "None", + "UserSetting", + "TPCDMetadata", + "TPCDDeprecationTrial", + "TopLevelTPCDDeprecationTrial", + "TPCDHeuristics", + "EnterprisePolicy", + "StorageAccess", + "TopLevelStorageAccess", + "Scheme" + ] + }, { "id": "BlockedSetCookieWithReason", "description": "A cookie which was not stored from a response with the corresponding reason.", @@ -17302,7 +17356,10 @@ "controlled-frame", "cross-origin-isolated", "deferred-fetch", +<<<<<<< HEAD "deferred-fetch-minimal", +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "digital-credentials-get", "direct-sockets", "direct-sockets-private", @@ -18694,8 +18751,12 @@ "EmbedderExtensionMessaging", "EmbedderExtensionMessagingForOpenPort", "EmbedderExtensionSentMessageToCachedFrame", +<<<<<<< HEAD "RequestedByWebViewClient", "PostMessageByWebViewClient" +======= + "RequestedByWebViewClient" +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 ] }, { @@ -22153,10 +22214,13 @@ "name": "scopesData", "optional": true, "$ref": "AttributionScopesData" +<<<<<<< HEAD }, { "name": "maxEventLevelReports", "type": "integer" +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 } ] }, @@ -22408,7 +22472,10 @@ "excessiveReportingOrigins", "noHistograms", "insufficientBudget", +<<<<<<< HEAD "insufficientNamedBudget", +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 "noMatchingSourceFilterData", "notRegistered", "prohibitedByBrowserPolicy", @@ -25646,6 +25713,7 @@ "description": "Assertions returned by this credential will have the backup state (BS)\nflag set to this value. Defaults to the authenticator's\ndefaultBackupState value.", "optional": true, "type": "boolean" +<<<<<<< HEAD }, { "name": "userName", @@ -25658,6 +25726,8 @@ "description": "The credential's user.displayName property. Equivalent to empty if\nnot set.\nhttps://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-displayname", "optional": true, "type": "string" +======= +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 } ] } @@ -26429,9 +26499,13 @@ "AllPrerenderingCanceled", "WindowClosed", "SlowNetwork", +<<<<<<< HEAD "OtherPrerenderedPageActivated", "V8OptimizerDisabled", "PrerenderFailedDuringPrefetch" +======= + "OtherPrerenderedPageActivated" +>>>>>>> 233a1fdb2c1dd51a4ca15a51f5fe82915cd9fe90 ] }, { diff --git a/pyproject.toml b/pyproject.toml index 81c4147..af6acc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ authors = [ ] [tool.poetry.dependencies] -python = "^3.8, <3.12" +python = ">=3.8,<4.0.0" deprecated = "^1.2.9" inflection = "^0.4.0" aiohttp = "^3.8.3"