-
Notifications
You must be signed in to change notification settings - Fork 0
WebRequest
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.
static WebRequest Create(Request request, WebRequestClient handler)
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.
Request GetRequest()
Returns the request object used to create this URL request. The returned object is read-only and should not be modified.
RequestStatus GetRequestStatus()
Returns the request status.
RequestStatuscan 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.
NetworkError GetRequestError()
Returns the request error if status is "Canceled" or "Failed", or 0
otherwise.
Response GetResponse()
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.
void Cancel()
Cancel the request.
Class used to make a web url request. Web url requests are not
associated with a browser instance so no Client Handler callbacks
will be executed. The methods of this class may be called on
any thread.
The WebRequest test can be found in the wxpython.py script.
static WebRequest CreateWebRequest(Request request, WebRequestClient handler)
You cannot instantiate WebRequest class directly, use this static
method instead by callingcefpython.WebRequest.CreateWebRequest().
The first parameter is a Request object that needs to be created
by callingcefpython.Request.CreateRequest().
The WebRequestClient handler is a python class that implements
one/all/none of 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 be called.
void Cancel()
Cancels the request.
RequestState GetState()
Returns the current ready state of the request.
RequestState is one of:
cefpython.WebRequest.State["Unsent"]
cefpython.WebRequest.State["Started"]
cefpython.WebRequest.State["HeadersReceived"]
cefpython.WebRequest.State["Loading"]
cefpython.WebRequest.State["Done"]
cefpython.WebRequest.State["Error"]
cefpython.WebRequest.State["Abort"]