Skip to content

Latest commit

 

History

History
106 lines (68 loc) · 2.84 KB

File metadata and controls

106 lines (68 loc) · 2.84 KB

API categories | API index

WebRequest (class)

Table of contents:

Preface

Class used to make a URL request. URL requests are not associated with a browser instance so no client handler callbacks will be executed. URL requests can be created on any valid CEF thread in either the browser or render process. Once created the methods of the URL request object must be accessed on the same thread that created it.

The WebRequest example can be found in the wxpython-response.py script on Linux.

Methods

Create

Parameter Type
request Request
handler WebRequestClient
Return static WebRequest

You cannot instantiate WebRequest class directly, use this static method instead by calling cefpython.WebRequest.Create().

The first parameter is a Request object that needs to be created by calling cefpython.Request.CreateRequest().

The WebRequestClient handler is a python class that implements the WebRequestClient callbacks.

You must keep a strong reference to the WebRequest object during the request, otherwise it gets destroyed and the WebRequestClient callbacks won't get called.

GetRequest

Return Request

Returns the request object used to create this URL request. The returned object is read-only and should not be modified.

GetRequestStatus

Return RequestStatus

Returns the request status. RequestStatus can be one of:

cefpython.WebRequest.Status["Unknown"] - Unknown status.
cefpython.WebRequest.Status["Success"] - Request succeeded.
cefpython.WebRequest.Status["Pending"] - An IO request is pending, and the caller will be informed when it is completed.
cefpython.WebRequest.Status["Canceled"] - Request was canceled programatically.
cefpython.WebRequest.Status["Failed"] - Request failed for some reason.

GetRequestError

Return NetworkError

Returns the request error if status is "Canceled" or "Failed", or 0
otherwise.

GetResponse

Return Response

Returns the response, or None if no response information is available.
Response information will only be available after the upload has completed.
The returned object is read-only and should not be modified.

Cancel

Return void

Cancel the request.