获取协议
Chrome DevTools 协议的获取域命令、事件和类型。
方法
pydoll.protocol.fetch.methods
TakeResponseBodyAsStreamResponse
module-attribute
TakeResponseBodyAsStreamResponse = Response[TakeResponseBodyAsStreamResult]
ContinueRequestCommand
module-attribute
ContinueRequestCommand = Command[ContinueRequestParams, EmptyResponse]
ContinueResponseCommand
module-attribute
ContinueResponseCommand = Command[ContinueResponseParams, EmptyResponse]
ContinueWithAuthCommand
module-attribute
ContinueWithAuthCommand = Command[ContinueWithAuthParams, EmptyResponse]
FulfillRequestCommand
module-attribute
FulfillRequestCommand = Command[FulfillRequestParams, EmptyResponse]
GetResponseBodyCommand
module-attribute
GetResponseBodyCommand = Command[GetResponseBodyParams, GetResponseBodyResponse]
TakeResponseBodyAsStreamCommand
module-attribute
TakeResponseBodyAsStreamCommand = Command[TakeResponseBodyAsStreamParams, TakeResponseBodyAsStreamResponse]
FetchMethod
Bases: str
, Enum
Fetch domain method names.
EnableParams
FailRequestParams
FulfillRequestParams
Bases: TypedDict
Parameters for fulfilling a request.
ContinueRequestParams
ContinueWithAuthParams
ContinueResponseParams
Bases: TypedDict
Parameters for continuing a response.
GetResponseBodyParams
TakeResponseBodyAsStreamParams
GetResponseBodyResult
事件
pydoll.protocol.fetch.events
FetchEvent
Bases: str
, Enum
Events from the Fetch domain of the Chrome DevTools Protocol.
This enumeration contains the names of Fetch-related events that can be received from the Chrome DevTools Protocol. These events provide information about network requests that can be intercepted, modified, or responded to by the client.
AUTH_REQUIRED
class-attribute
instance-attribute
Issued when the domain is enabled with handleAuthRequests set to true. The request is paused until client responds with continueWithAuth.
PARAMETER | DESCRIPTION |
---|---|
requestId
|
Each request the page makes will have a unique id.
TYPE:
|
request
|
The details of the request.
TYPE:
|
frameId
|
The id of the frame that initiated the request.
TYPE:
|
resourceType
|
How the requested resource will be used.
TYPE:
|
authChallenge
|
Details of the Authorization Challenge encountered. If this is set, client should respond with continueRequest that contains AuthChallengeResponse.
TYPE:
|
REQUEST_PAUSED
class-attribute
instance-attribute
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.
Redirect responses and subsequent requests are reported similarly to regular responses and requests. Redirect responses may be distinguished by the value of responseStatusCode (which is one of 301, 302, 303, 307, 308) along with presence of the location header. Requests resulting from a redirect will have redirectedRequestId field set.
PARAMETER | DESCRIPTION |
---|---|
requestId
|
Each request the page makes will have a unique id.
TYPE:
|
request
|
The details of the request.
TYPE:
|
frameId
|
The id of the frame that initiated the request.
TYPE:
|
resourceType
|
How the requested resource will be used.
TYPE:
|
responseErrorReason
|
Response error if intercepted at response stage.
TYPE:
|
responseStatusCode
|
Response code if intercepted at response stage.
TYPE:
|
responseStatusText
|
Response status text if intercepted at response stage.
TYPE:
|
responseHeaders
|
Response headers if intercepted at the response stage.
TYPE:
|
networkId
|
If the intercepted request had a corresponding Network.requestWillBeSent event fired for it, then this networkId will be the same as the requestId present in the requestWillBeSent event.
TYPE:
|
redirectedRequestId
|
If the request is due to a redirect response from the server, the id of the request that has caused the redirect.
TYPE:
|
AuthRequiredEventParams
RequestPausedEventParams
Bases: TypedDict
Parameters for the RequestPaused event.
类型
pydoll.protocol.fetch.types
RequestStage
AuthChallengeSource
AuthChallengeResponseType
Bases: str
, Enum
The decision on what to do in response to the authorization challenge.