Skip to content

schema

Domain dataclass

Description of the protocol domain.

Source code in zendriver/cdp/schema.py
@dataclass
class Domain:
    """
    Description of the protocol domain.
    """

    #: Domain name.
    name: str

    #: Domain version.
    version: str

    def to_json(self) -> T_JSON_DICT:
        json: T_JSON_DICT = dict()
        json["name"] = self.name
        json["version"] = self.version
        return json

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> Domain:
        return cls(
            name=str(json["name"]),
            version=str(json["version"]),
        )

name: str instance-attribute

version: str instance-attribute

__init__(name, version)

from_json(json) classmethod

Source code in zendriver/cdp/schema.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> Domain:
    return cls(
        name=str(json["name"]),
        version=str(json["version"]),
    )

to_json()

Source code in zendriver/cdp/schema.py
def to_json(self) -> T_JSON_DICT:
    json: T_JSON_DICT = dict()
    json["name"] = self.name
    json["version"] = self.version
    return json

get_domains()

Returns supported domains.

Returns:

Type Description
Generator[T_JSON_DICT, T_JSON_DICT, List[Domain]]

List of supported domains.

Source code in zendriver/cdp/schema.py
def get_domains() -> typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[Domain]]:
    """
    Returns supported domains.

    :returns: List of supported domains.
    """
    cmd_dict: T_JSON_DICT = {
        "method": "Schema.getDomains",
    }
    json = yield cmd_dict
    return [Domain.from_json(i) for i in json["domains"]]