예제 #1
0
class Response(CustomizedDataClassJsonMixin):
    status: int
    status_text: str
    http_version: str
    cookies: List[Cookie]
    headers: List[Header]
    content: Content
    headers_size: int
    body_size: int
    redirect_url: str = field(metadata=config(field_name="redirectURL"))
    comment: Optional[str] = None

    _transfer_size: Optional[int] = field(
        default=None, metadata=config(field_name="_transferSize"))
예제 #2
0
class Page(CustomizedDataClassJsonMixin):
    started_date_time: datetime = field(metadata=config(
        encoder=datetime_encoder))
    id: str
    title: str
    page_timings: PageTimings
    comment: Optional[str] = None
예제 #3
0
class Entry(CustomizedDataClassJsonMixin):
    started_date_time: datetime = field(
        metadata=config(encoder=datetime_encoder, ))
    time: Union[int, float]
    request: Request
    response: Response
    cache: Cache
    timings: Timings
    pageref: Optional[str] = None
    server_ip_address: Optional[str] = field(
        default=None, metadata=config(field_name="serverIPAddress"))
    comment: Optional[str] = None

    _server_port: Optional[int] = field(
        default=None, metadata=config(field_name="_serverPort"))
    _security_details: Optional[SecurityDetails] = field(
        default=None, metadata=config(field_name="_securityDetails"))
예제 #4
0
class Cookie(CustomizedDataClassJsonMixin):
    name: str
    value: str
    path: Optional[str] = None
    domain: Optional[str] = None
    expires: Optional[datetime] = field(
        default=None,
        metadata=config(encoder=datetime_encoder, ),
    )
    http_only: bool = False
    secure: bool = False
    same_site: Optional[str] = None
예제 #5
0
def _process_class(cls, letter_case, undefined):
    if letter_case is not None or undefined is not None:
        cls.dataclass_json_config = config(
            letter_case=letter_case, undefined=undefined)['dataclasses_json']

    cls.to_json = DataClassJsonMixin.to_json
    # unwrap and rewrap classmethod to tag it to cls rather than the literal
    # DataClassJsonMixin ABC
    cls.from_json = classmethod(DataClassJsonMixin.from_json.__func__)
    cls.to_dict = DataClassJsonMixin.to_dict
    cls.from_dict = classmethod(DataClassJsonMixin.from_dict.__func__)
    cls.schema = classmethod(DataClassJsonMixin.schema.__func__)

    cls.__init__ = _handle_undefined_parameters_safe(cls, kvs=(), usage="init")
    # register cls as a virtual subclass of DataClassJsonMixin
    DataClassJsonMixin.register(cls)
    return cls
예제 #6
0
class Response(CustomizedDataClassJsonMixin):
    url: str
    status: int
    status_text: str
    headers: Dict[str, Any]
    mime_type: str
    connection_reused: bool
    connection_id: int
    encoded_data_length: int
    security_state: str
    response_time: Optional[float] = None
    request_headers: Optional[Dict[str, Any]] = None
    request_headers_text: Optional[str] = None
    remote_ip_address: Optional[str] = field(
        default=None, metadata=config(field_name="remoteIPAddress"))
    remote_port: Optional[int] = None
    from_disk_cache: Optional[bool] = None
    from_service_worker: Optional[bool] = None
    from_prefetch_cache: Optional[bool] = None
    timing: Optional[Dict[str, float]] = None
    protocol: Optional[str] = None
    headers_text: Optional[str] = None
예제 #7
0
class CustomizedDataClassJsonMixin(DataClassJsonMixin):
    dataclass_json_config = config(
        letter_case=LetterCase.CAMEL,
        undefined=Undefined.EXCLUDE,
        exclude=lambda f: f is None,
    )["dataclasses_json"]
예제 #8
0
class DataClassWithConfigHelper:
    id: float = field(metadata=config(encoder=str))