1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
U
[±dµ>ã    @sšddlmZddlmZmZddlmZddlZddlZddl    m
Z
ddl    m Z ddl    m Z Gd    d
„d
e ƒZGd d „d ejƒZeGd d„dƒƒZeGdd„dƒƒZeGdd„dƒƒZeGdd„dƒƒZddœdd„Zd;ddddœdd„Zd
dddœd d!„Zd<d
d"d#d$d$d$dd%œd&d'„Zd=d
d$d$d$d#dd(œd)d*„Zd
ddd+œd,d-„Zd
d.d/œd0d1„Zd
d2d/œd3d4„Zed5ƒeGd6d7„d7ƒƒƒZed8ƒeGd9d:„d:ƒƒƒZdS)>é)Ú annotationsé)Ú event_classÚ T_JSON_DICT)Ú    dataclassN)Úio)Únetwork)ÚpagecsBeZdZdZddœdd„Zedddœdd„ƒZ‡fd    d
„Z‡ZS) Ú    RequestIdz$
    Unique request identifier.
    Ústr©ÚreturncCs|S©N©©Úselfrrúcd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/common/devtools/v85/fetch.pyÚto_jsonszRequestId.to_json©Újsonr cCs||ƒSrr©ÚclsrrrrÚ    from_jsonszRequestId.from_jsoncsd tƒ ¡¡S)Nz RequestId({}))ÚformatÚsuperÚ__repr__r©Ú    __class__rrrszRequestId.__repr__)    Ú__name__Ú
__module__Ú __qualname__Ú__doc__rÚ classmethodrrÚ __classcell__rrrrr
s
r
c@s,eZdZdZdZdZdd„Zedd„ƒZdS)    Ú RequestStagezÃ
    Stages of the request to handle. Request will intercept before the request is
    sent. Response will intercept after the response is received (but before response
    body is received.
    ÚRequestÚResponsecCs|jSr)Úvaluerrrrr)szRequestStage.to_jsoncCs||ƒSrrrrrrr,szRequestStage.from_jsonN)    rrr r!ZREQUESTZRESPONSErr"rrrrrr$ s r$c@sFeZdZUdZded<dZded<dZded<dd    „Zed
d „ƒZ    dS) ÚRequestPatternNútyping.Optional[str]Ú url_patternz%typing.Optional[network.ResourceType]Ú resource_typeztyping.Optional[RequestStage]Ú request_stagecCsNtƒ}|jdk    r|j|d<|jdk    r2|j ¡|d<|jdk    rJ|j ¡|d<|S)NÚ
urlPatternÚ resourceTypeÚ requestStage)Údictr*r+rr,©rrrrrr=s
 
 
 
zRequestPattern.to_jsoncCsP|d|krt|dƒndd|kr0tj |d¡ndd|krHt |d¡nddS)Nr-r.r/)r*r+r,)r rÚ ResourceTyperr$rrrrrGs
ýzRequestPattern.from_json)
rrr r*Ú__annotations__r+r,rr"rrrrrr(1s
 
r(c@s6eZdZUdZded<ded<dd„Zedd„ƒZd    S)
Ú HeaderEntryz$
    Response HTTP header entry
    r Únamer'cCstƒ}|j|d<|j|d<|S)Nr5r')r0r5r'r1rrrrYs
 
zHeaderEntry.to_jsoncCs|t|dƒt|dƒdS)Nr5r')r5r'©r rrrrr_s
 
þzHeaderEntry.from_jsonN)rrr r!r3rr"rrrrrr4Ps
r4c@sJeZdZUdZded<ded<ded<dZded<d    d
„Zed d „ƒZdS) Ú AuthChallengezB
    Authorization challenge for HTTP status code 401 or 407.
    r ÚoriginÚschemeÚrealmNr)ÚsourcecCs<tƒ}|j|d<|j|d<|j|d<|jdk    r8|j|d<|S)Nr8r9r:r;)r0r8r9r:r;r1rrrrxs
 
 
 
 
zAuthChallenge.to_jsoncCs<|t|dƒt|dƒt|dƒd|kr4t|dƒnddS)Nr8r9r:r;)r8r9r:r;r6rrrrrs 
 
 
üzAuthChallenge.from_json)    rrr r!r3r;rr"rrrrrr7gs
     r7c@sFeZdZUdZded<dZded<dZded<dd    „Zed
d „ƒZ    dS) ÚAuthChallengeResponsez'
    Response to an AuthChallenge.
    r ÚresponseNr)ÚusernameÚpasswordcCs<tƒ}|j|d<|jdk    r$|j|d<|jdk    r8|j|d<|S)Nr=r>r?)r0r=r>r?r1rrrrs
 
 
 
 
zAuthChallengeResponse.to_jsoncCs>|t|dƒd|kr t|dƒndd|kr6t|dƒnddS)Nr=r>r?)r=r>r?r6rrrrr¦s
 
ýzAuthChallengeResponse.from_json)
rrr r!r3r>r?rr"rrrrrr<‹s
      r<z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]r ccsddi}|V}dS)z$
    Disables the fetch domain.
    Úmethodz Fetch.disableNr)Úcmd_dictrrrrÚdisable¯sÿrBz,typing.Optional[typing.List[RequestPattern]]ztyping.Optional[bool])ÚpatternsÚhandle_auth_requestsr ccsDtƒ}|dk    r dd„|Dƒ|d<|dk    r0||d<d|dœ}|V}dS)a
    Enables issuing of requestPaused events. A request will be paused until client
    calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.
 
    :param patterns: *(Optional)* If specified, only requests matching any of these patterns will produce fetchRequested event and will be paused until clients response. If not set, all requests will be affected.
    :param handle_auth_requests: *(Optional)* If true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth.
    NcSsg|] }| ¡‘qSr©r©Ú.0ÚirrrÚ
<listcomp>Æszenable.<locals>.<listcomp>rCZhandleAuthRequestsz Fetch.enable©r@Úparams)r0)rCrDrKrArrrrÚenable¹s þrLznetwork.ErrorReason)Ú
request_idÚ error_reasonr ccs2tƒ}| ¡|d<| ¡|d<d|dœ}|V}dS)zÐ
    Causes the request to fail with specified reason.
 
    :param request_id: An id the client received in requestPaused event.
    :param error_reason: Causes the request to fail with the given reason.
    Ú    requestIdZ errorReasonzFetch.failRequestrJN©r0r)rMrNrKrArrrrÚ fail_requestÐs
  þrQÚintú)typing.Optional[typing.List[HeaderEntry]]r))rMÚ response_codeÚresponse_headersÚbinary_response_headersÚbodyÚresponse_phraser c    csxtƒ}| ¡|d<||d<|dk    r4dd„|Dƒ|d<|dk    rD||d<|dk    rT||d<|dk    rd||d    <d
|d œ}|V}dS) a­
    Provides response to the request.
 
    :param request_id: An id the client received in requestPaused event.
    :param response_code: An HTTP response code.
    :param response_headers: *(Optional)* Response headers.
    :param binary_response_headers: *(Optional)* Alternative way of specifying response headers as a -separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can't be transmitted over the protocol as text.
    :param body: *(Optional)* A response body.
    :param response_phrase: *(Optional)* A textual representation of responseCode. If absent, a standard phrase matching responseCode is used.
    rOZ responseCodeNcSsg|] }| ¡‘qSrrErFrrrrIúsz#fulfill_request.<locals>.<listcomp>ÚresponseHeadersZbinaryResponseHeadersrWZresponsePhrasezFetch.fulfillRequestrJrP)    rMrTrUrVrWrXrKrArrrrÚfulfill_requestäs þrZ)rMÚurlr@Ú    post_dataÚheadersr ccsptƒ}| ¡|d<|dk    r"||d<|dk    r2||d<|dk    rB||d<|dk    r\dd„|Dƒ|d<d    |d
œ}|V}dS) aê
    Continues the request, optionally modifying some of its parameters.
 
    :param request_id: An id the client received in requestPaused event.
    :param url: *(Optional)* If set, the request url will be modified in a way that's not observable by page.
    :param method: *(Optional)* If set, the request method is overridden.
    :param post_data: *(Optional)* If set, overrides the post data in the request.
    :param headers: *(Optional)* If set, overrides the request headers.
    rONr[r@ZpostDatacSsg|] }| ¡‘qSrrErFrrrrI!sz$continue_request.<locals>.<listcomp>r]zFetch.continueRequestrJrP)rMr[r@r\r]rKrArrrrÚcontinue_requests þr^)rMÚauth_challenge_responser ccs2tƒ}| ¡|d<| ¡|d<d|dœ}|V}dS)zì
    Continues a request supplying authChallengeResponse following authRequired event.
 
    :param request_id: An id the client received in authRequired event.
    :param auth_challenge_response: Response to  with an authChallenge.
    rOZauthChallengeResponsezFetch.continueWithAuthrJNrP)rMr_rKrArrrrÚcontinue_with_auth)s
  þr`zCtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[str, bool]])rMr ccs:tƒ}| ¡|d<d|dœ}|V}t|dƒt|dƒfS)aw
    Causes the body of the response to be received from the server and
    returned as a single string. May only be issued for a request that
    is paused in the Response stage and is mutually exclusive with
    takeResponseBodyForInterceptionAsStream. Calling other methods that
    affect the request or disabling fetch domain before body is received
    results in an undefined behavior.
 
    :param request_id: Identifier for the intercepted request to get body for.
    :returns: A tuple with the following items:
 
        0. **body** - Response body.
        1. **base64Encoded** - True, if content was sent as base64.
    rOzFetch.getResponseBodyrJrWZ base64Encoded)r0rr Úbool©rMrKrArrrrÚget_response_body=s þ
 
þrcz;typing.Generator[T_JSON_DICT, T_JSON_DICT, io.StreamHandle]ccs2tƒ}| ¡|d<d|dœ}|V}tj |d¡S)ag
    Returns a handle to the stream representing the response body.
    The request must be paused in the HeadersReceived stage.
    Note that after this command the request can't be continued
    as is -- client either needs to cancel it or to provide the
    response body.
    The stream only supports sequential read, IO.read will fail if the position
    is specified.
    This method is mutually exclusive with getResponseBody.
    Calling other methods that affect the request or disabling fetch
    domain before body is received results in an undefined behavior.
 
    :param request_id:
    :returns: 
    rOzFetch.takeResponseBodyAsStreamrJÚstream)r0rrZ StreamHandlerrbrrrÚtake_response_body_as_stream[s þrezFetch.requestPausedc@sfeZdZUdZded<ded<ded<ded    <d
ed <d ed <ded<ded<edddœdd„ƒZdS)Ú RequestPauseda³
    Issued when the domain is enabled and the request URL matches the
    specified filter. The request is paused until the client responds
    with one of continueRequest, failRequest or fulfillRequest.
    The stage of the request can be determined by presence of responseErrorReason
    and responseStatusCode -- the request is at the response stage if either
    of these fields is present and in the request stage otherwise.
    r
rMúnetwork.RequestÚrequestú page.FrameIdÚframe_idúnetwork.ResourceTyper+z$typing.Optional[network.ErrorReason]Úresponse_error_reasonztyping.Optional[int]Úresponse_status_coderSrUztyping.Optional[RequestId]Ú
network_idrrc Cs¢|t |d¡tj |d¡tj |d¡tj |d¡d|krPtj |d¡ndd|krft|dƒndd|kr‚dd    „|dDƒndd
|kršt |d
¡ndd S) NrOrhÚframeIdr.ZresponseErrorReasonZresponseStatusCoderYcSsg|]}t |¡‘qSr)r4rrFrrrrIsz+RequestPaused.from_json.<locals>.<listcomp>Z    networkId)rMrhrjr+rlrmrUrn)    r
rrr%r    ÚFrameIdr2Z ErrorReasonrRrrrrr”s øzRequestPaused.from_jsonN©rrr r!r3r"rrrrrrfws
    rfzFetch.authRequiredc@sNeZdZUdZded<ded<ded<ded    <d
ed <ed dd œdd„ƒZdS)Ú AuthRequiredz—
    Issued when the domain is enabled with handleAuthRequests set to true.
    The request is paused until client responds with continueWithAuth.
    r
rMrgrhrirjrkr+r7Úauth_challengerrc    CsJ|t |d¡tj |d¡tj |d¡tj |d¡t |d¡dS)NrOrhror.Z authChallenge)rMrhrjr+rs)r
rrr%r    rpr2r7rrrrr¶s  ûzAuthRequired.from_jsonNrqrrrrrr¢s
rr)NN)NNNN)NNNN)Ú
__future__rÚutilrrZ dataclassesrÚenumÚtypingÚrrr    r r
ÚEnumr$r(r4r7r<rBrLrQrZr^r`rcrerfrrrrrrÚ<module>sR     ## þú&û!)