WebKit2.WebResource¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
|||
r |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
This signal is emitted when an error occurs during the resource load operation. |
|
This signal is emitted when a TLS error occurs during the resource load operation. |
|
This signal is emitted when the resource load finishes successfully or due to an error. |
|
This signal is emitted after response is received, every time new data has been received. |
|
This signal is emitted when request has been sent to the server. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class WebKit2.WebResource(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Represents a resource at the end of a URI.
A
WebKit2.WebResourceencapsulates content for each resource at the end of a particular URI. For example, oneWebKit2.WebResourcewill be created for each separate image and stylesheet when a page is loaded.You can access the response and the URI for a given
WebKit2.WebResource, usingWebKit2.WebResource.get_uri() andWebKit2.WebResource.get_response(), as well as the raw data, usingWebKit2.WebResource.get_data().- get_data(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.CancellableorNoneto ignorecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously get the raw data for self.
When the operation is finished, callback will be called. You can then call
WebKit2.WebResource.get_data_finish() to get the result of the operation.
- get_data_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
a string with the data of self, or
Nonein case of error. if length is notNone, the size of the data will be assigned to it.- Return type:
Finish an asynchronous operation started with
WebKit2.WebResource.get_data().
- get_response()¶
- Returns:
the
WebKit2.URIResponse, orNoneif the response hasn’t been received yet.- Return type:
Retrieves the
WebKit2.URIResponseof the resource load operation.This method returns
Noneif called before the response is received from the server. You can connect to notify::response signal to be notified when the response is received.
- get_uri()¶
- Returns:
the current active URI of self
- Return type:
Returns the current active URI of self.
The active URI might change during a load operation:
When the resource load starts, the active URI is the requested URI
When the initial request is sent to the server,
WebKit2.WebResource::sent-requestsignal is emitted without a redirected response, the active URI is the URI of the request sent to the server.In case of a server redirection,
WebKit2.WebResource::sent-requestsignal is emitted again with a redirected response, the active URI is the URI the request was redirected to.When the response is received from the server, the active URI is the final one and it will not change again.
You can monitor the active URI by connecting to the notify::uri signal of self.
Signal Details¶
- WebKit2.WebResource.signals.failed(web_resource, error)¶
- Signal Name:
failed- Flags:
- Parameters:
web_resource (
WebKit2.WebResource) – The object which received the signalerror (
GLib.Error) – theGLib.Errorthat was triggered
This signal is emitted when an error occurs during the resource load operation.
- WebKit2.WebResource.signals.failed_with_tls_errors(web_resource, certificate, errors)¶
- Signal Name:
failed-with-tls-errors- Flags:
- Parameters:
web_resource (
WebKit2.WebResource) – The object which received the signalcertificate (
Gio.TlsCertificate) – aGio.TlsCertificateerrors (
Gio.TlsCertificateFlags) – aGio.TlsCertificateFlagswith the verification status of certificate
This signal is emitted when a TLS error occurs during the resource load operation.
New in version 2.8.
- WebKit2.WebResource.signals.finished(web_resource)¶
- Signal Name:
finished- Flags:
- Parameters:
web_resource (
WebKit2.WebResource) – The object which received the signal
This signal is emitted when the resource load finishes successfully or due to an error. In case of errors
WebKit2.WebResource::failedsignal is emitted before this one.
- WebKit2.WebResource.signals.received_data(web_resource, data_length)¶
- Signal Name:
received-data- Flags:
- Parameters:
web_resource (
WebKit2.WebResource) – The object which received the signaldata_length (
int) – the length of data received in bytes
This signal is emitted after response is received, every time new data has been received. It’s useful to know the progress of the resource load operation.
This is signal is deprecated since version 2.40 and it’s never emitted.
Deprecated since version 2.40.
- WebKit2.WebResource.signals.sent_request(web_resource, request, redirected_response)¶
- Signal Name:
sent-request- Flags:
- Parameters:
web_resource (
WebKit2.WebResource) – The object which received the signalrequest (
WebKit2.URIRequest) – aWebKit2.URIRequestredirected_response (
WebKit2.URIResponse) – aWebKit2.URIResponse, orNone
This signal is emitted when request has been sent to the server. In case of a server redirection this signal is emitted again with the request argument containing the new request sent to the server due to the redirection and the redirected_response parameter containing the response received by the server for the initial request.
Property Details¶
- WebKit2.WebResource.props.response¶
- Name:
response- Type:
- Default Value:
- Flags:
The
WebKit2.URIResponseassociated with this resource.
- WebKit2.WebResource.props.uri¶
-
The current active URI of the
WebKit2.WebResource. SeeWebKit2.WebResource.get_uri() for more details.