@@ -931,6 +931,114 @@ def from_json(cls, json: T_JSON_DICT) -> 'Cookie':
931931 )
932932
933933
934+ class SetCookieBlockedReason (enum .Enum ):
935+ '''
936+ Types of reasons why a cookie may not be stored from a response.
937+ '''
938+ SECURE_ONLY = "SecureOnly"
939+ SAME_SITE_STRICT = "SameSiteStrict"
940+ SAME_SITE_LAX = "SameSiteLax"
941+ SAME_SITE_EXTENDED = "SameSiteExtended"
942+ SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "SameSiteUnspecifiedTreatedAsLax"
943+ SAME_SITE_NONE_INSECURE = "SameSiteNoneInsecure"
944+ USER_PREFERENCES = "UserPreferences"
945+ SYNTAX_ERROR = "SyntaxError"
946+ SCHEME_NOT_SUPPORTED = "SchemeNotSupported"
947+ OVERWRITE_SECURE = "OverwriteSecure"
948+ INVALID_DOMAIN = "InvalidDomain"
949+ INVALID_PREFIX = "InvalidPrefix"
950+ UNKNOWN_ERROR = "UnknownError"
951+
952+ def to_json (self ) -> str :
953+ return self .value
954+
955+ @classmethod
956+ def from_json (cls , json : str ) -> 'SetCookieBlockedReason' :
957+ return cls (json )
958+
959+
960+ class CookieBlockedReason (enum .Enum ):
961+ '''
962+ Types of reasons why a cookie may not be sent with a request.
963+ '''
964+ SECURE_ONLY = "SecureOnly"
965+ NOT_ON_PATH = "NotOnPath"
966+ DOMAIN_MISMATCH = "DomainMismatch"
967+ SAME_SITE_STRICT = "SameSiteStrict"
968+ SAME_SITE_LAX = "SameSiteLax"
969+ SAME_SITE_EXTENDED = "SameSiteExtended"
970+ SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "SameSiteUnspecifiedTreatedAsLax"
971+ SAME_SITE_NONE_INSECURE = "SameSiteNoneInsecure"
972+ USER_PREFERENCES = "UserPreferences"
973+ UNKNOWN_ERROR = "UnknownError"
974+
975+ def to_json (self ) -> str :
976+ return self .value
977+
978+ @classmethod
979+ def from_json (cls , json : str ) -> 'CookieBlockedReason' :
980+ return cls (json )
981+
982+
983+ @dataclass
984+ class BlockedSetCookieWithReason :
985+ '''
986+ A cookie which was not stored from a response with the corresponding reason.
987+ '''
988+ #: The reason this cookie was blocked.
989+ blocked_reason : 'SetCookieBlockedReason'
990+
991+ #: The string representing this individual cookie as it would appear in the header.
992+ #: This is not the entire "cookie" or "set-cookie" header which could have multiple cookies.
993+ cookie_line : str
994+
995+ #: The cookie object which represents the cookie which was not stored. It is optional because
996+ #: sometimes complete cookie information is not available, such as in the case of parsing
997+ #: errors.
998+ cookie : typing .Optional ['Cookie' ] = None
999+
1000+ def to_json (self ) -> T_JSON_DICT :
1001+ json : T_JSON_DICT = dict ()
1002+ json ['blockedReason' ] = self .blocked_reason .to_json ()
1003+ json ['cookieLine' ] = self .cookie_line
1004+ if self .cookie is not None :
1005+ json ['cookie' ] = self .cookie .to_json ()
1006+ return json
1007+
1008+ @classmethod
1009+ def from_json (cls , json : T_JSON_DICT ) -> 'BlockedSetCookieWithReason' :
1010+ return cls (
1011+ blocked_reason = SetCookieBlockedReason .from_json (json ['blockedReason' ]),
1012+ cookie_line = str (json ['cookieLine' ]),
1013+ cookie = Cookie .from_json (json ['cookie' ]) if 'cookie' in json else None ,
1014+ )
1015+
1016+
1017+ @dataclass
1018+ class BlockedCookieWithReason :
1019+ '''
1020+ A cookie with was not sent with a request with the corresponding reason.
1021+ '''
1022+ #: The reason the cookie was blocked.
1023+ blocked_reason : 'CookieBlockedReason'
1024+
1025+ #: The cookie object representing the cookie which was not sent.
1026+ cookie : 'Cookie'
1027+
1028+ def to_json (self ) -> T_JSON_DICT :
1029+ json : T_JSON_DICT = dict ()
1030+ json ['blockedReason' ] = self .blocked_reason .to_json ()
1031+ json ['cookie' ] = self .cookie .to_json ()
1032+ return json
1033+
1034+ @classmethod
1035+ def from_json (cls , json : T_JSON_DICT ) -> 'BlockedCookieWithReason' :
1036+ return cls (
1037+ blocked_reason = CookieBlockedReason .from_json (json ['blockedReason' ]),
1038+ cookie = Cookie .from_json (json ['cookie' ]),
1039+ )
1040+
1041+
9341042@dataclass
9351043class CookieParam :
9361044 '''
@@ -1203,12 +1311,16 @@ class SignedExchangeHeader:
12031311 #: Signed exchange response signature.
12041312 signatures : typing .List ['SignedExchangeSignature' ]
12051313
1314+ #: Signed exchange header integrity hash in the form of "sha256-<base64-hash-value>".
1315+ header_integrity : str
1316+
12061317 def to_json (self ) -> T_JSON_DICT :
12071318 json : T_JSON_DICT = dict ()
12081319 json ['requestUrl' ] = self .request_url
12091320 json ['responseCode' ] = self .response_code
12101321 json ['responseHeaders' ] = self .response_headers .to_json ()
12111322 json ['signatures' ] = [i .to_json () for i in self .signatures ]
1323+ json ['headerIntegrity' ] = self .header_integrity
12121324 return json
12131325
12141326 @classmethod
@@ -1218,6 +1330,7 @@ def from_json(cls, json: T_JSON_DICT) -> 'SignedExchangeHeader':
12181330 response_code = int (json ['responseCode' ]),
12191331 response_headers = Headers .from_json (json ['responseHeaders' ]),
12201332 signatures = [SignedExchangeSignature .from_json (i ) for i in json ['signatures' ]],
1333+ header_integrity = str (json ['headerIntegrity' ]),
12211334 )
12221335
12231336
@@ -1384,6 +1497,7 @@ def continue_intercepted_request(
13841497 modifications, or blocks it, or completes it with the provided response bytes. If a network
13851498 fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted
13861499 event will be sent with the same InterceptionId.
1500+ Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.
13871501
13881502 :param interception_id:
13891503 :param error_reason: If set this causes the request to fail with the given reason. Passing ``Aborted`` for requests
@@ -1872,6 +1986,7 @@ def set_request_interception(
18721986 ) -> typing .Generator [T_JSON_DICT ,T_JSON_DICT ,None ]:
18731987 '''
18741988 Sets the requests to intercept that match the provided patterns and optionally resource types.
1989+ Deprecated, please use Fetch.enable instead.
18751990
18761991 :param patterns: Requests matching any of these patterns will be forwarded and wait for the corresponding
18771992 continueInterceptedRequest call.
@@ -2026,6 +2141,7 @@ class RequestIntercepted:
20262141 '''
20272142 Details of an intercepted HTTP request, which must be either allowed, blocked, modified or
20282143 mocked.
2144+ Deprecated, use Fetch.requestPaused instead.
20292145 '''
20302146 #: Each request the page makes will have a unique id, however if any redirects are encountered
20312147 #: while processing that fetch, they will be reported with the same id as the original fetch.
@@ -2363,3 +2479,59 @@ def from_json(cls, json: T_JSON_DICT) -> 'WebSocketWillSendHandshakeRequest':
23632479 wall_time = TimeSinceEpoch .from_json (json ['wallTime' ]),
23642480 request = WebSocketRequest .from_json (json ['request' ])
23652481 )
2482+
2483+
2484+ @event_class ('Network.requestWillBeSentExtraInfo' )
2485+ @dataclass
2486+ class RequestWillBeSentExtraInfo :
2487+ '''
2488+ Fired when additional information about a requestWillBeSent event is available from the
2489+ network stack. Not every requestWillBeSent event will have an additional
2490+ requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent
2491+ or requestWillBeSentExtraInfo will be fired first for the same request.
2492+ '''
2493+ #: Request identifier. Used to match this information to an existing requestWillBeSent event.
2494+ request_id : 'RequestId'
2495+ #: A list of cookies which will not be sent with this request along with corresponding reasons
2496+ #: for blocking.
2497+ blocked_cookies : typing .List ['BlockedCookieWithReason' ]
2498+ #: Raw request headers as they will be sent over the wire.
2499+ headers : 'Headers'
2500+
2501+ @classmethod
2502+ def from_json (cls , json : T_JSON_DICT ) -> 'RequestWillBeSentExtraInfo' :
2503+ return cls (
2504+ request_id = RequestId .from_json (json ['requestId' ]),
2505+ blocked_cookies = [BlockedCookieWithReason .from_json (i ) for i in json ['blockedCookies' ]],
2506+ headers = Headers .from_json (json ['headers' ])
2507+ )
2508+
2509+
2510+ @event_class ('Network.responseReceivedExtraInfo' )
2511+ @dataclass
2512+ class ResponseReceivedExtraInfo :
2513+ '''
2514+ Fired when additional information about a responseReceived event is available from the network
2515+ stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for
2516+ it, and responseReceivedExtraInfo may be fired before or after responseReceived.
2517+ '''
2518+ #: Request identifier. Used to match this information to another responseReceived event.
2519+ request_id : 'RequestId'
2520+ #: A list of cookies which were not stored from the response along with the corresponding
2521+ #: reasons for blocking. The cookies here may not be valid due to syntax errors, which
2522+ #: are represented by the invalid cookie line string instead of a proper cookie.
2523+ blocked_cookies : typing .List ['BlockedSetCookieWithReason' ]
2524+ #: Raw response headers as they were received over the wire.
2525+ headers : 'Headers'
2526+ #: Raw response header text as it was received over the wire. The raw text may not always be
2527+ #: available, such as in the case of HTTP/2 or QUIC.
2528+ headers_text : typing .Optional [str ]
2529+
2530+ @classmethod
2531+ def from_json (cls , json : T_JSON_DICT ) -> 'ResponseReceivedExtraInfo' :
2532+ return cls (
2533+ request_id = RequestId .from_json (json ['requestId' ]),
2534+ blocked_cookies = [BlockedSetCookieWithReason .from_json (i ) for i in json ['blockedCookies' ]],
2535+ headers = Headers .from_json (json ['headers' ]),
2536+ headers_text = str (json ['headersText' ]) if 'headersText' in json else None
2537+ )
0 commit comments