WebKit.WebResource

g GObject.Object GObject.Object WebKit.WebResource WebKit.WebResource GObject.Object->WebKit.WebResource

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_data (cancellable, callback, *user_data)

get_data_finish (result)

get_response ()

get_uri ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

response

WebKit.URIResponse

r

uri

str

r

Signals

Inherited:

GObject.Object (1)

Name

Short Description

failed

This signal is emitted when an error occurs during the resource load operation.

failed-with-tls-errors

This signal is emitted when a TLS error occurs during the resource load operation.

finished

This signal is emitted when the resource load finishes successfully or due to an error.

sent-request

This signal is emitted when request has been sent to the server.

Fields

Inherited:

GObject.Object (1)

Class Details

class WebKit.WebResource(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit.WebResourceClass

Represents a resource at the end of a URI.

A WebKit.WebResource encapsulates content for each resource at the end of a particular URI. For example, one WebKit.WebResource will be created for each separate image and stylesheet when a page is loaded.

You can access the response and the URI for a given WebKit.WebResource, using WebKit.WebResource.get_uri() and WebKit.WebResource.get_response(), as well as the raw data, using WebKit.WebResource.get_data().

get_data(cancellable, callback, *user_data)
Parameters:

Asynchronously get the raw data for self.

When the operation is finished, callback will be called. You can then call WebKit.WebResource.get_data_finish() to get the result of the operation.

get_data_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

a string with the data of self, or None in case of error. if length is not None, the size of the data will be assigned to it.

Return type:

bytes

Finish an asynchronous operation started with WebKit.WebResource.get_data().

get_response()
Returns:

the WebKit.URIResponse, or None if the response hasn’t been received yet.

Return type:

WebKit.URIResponse

Retrieves the WebKit.URIResponse of the resource load operation.

This method returns None if 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:

str

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, WebKit.WebResource ::sent-request signal 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, WebKit.WebResource ::sent-request signal 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

WebKit.WebResource.signals.failed(web_resource, error)
Signal Name:

failed

Flags:

RUN_LAST

Parameters:

This signal is emitted when an error occurs during the resource load operation.

WebKit.WebResource.signals.failed_with_tls_errors(web_resource, certificate, errors)
Signal Name:

failed-with-tls-errors

Flags:

RUN_LAST

Parameters:

This signal is emitted when a TLS error occurs during the resource load operation.

New in version 2.8.

WebKit.WebResource.signals.finished(web_resource)
Signal Name:

finished

Flags:

RUN_LAST

Parameters:

web_resource (WebKit.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 WebKit.WebResource ::failed signal is emitted before this one.

WebKit.WebResource.signals.sent_request(web_resource, request, redirected_response)
Signal Name:

sent-request

Flags:

RUN_LAST

Parameters:

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

WebKit.WebResource.props.response
Name:

response

Type:

WebKit.URIResponse

Default Value:

None

Flags:

READABLE

The WebKit.URIResponse associated with this resource.

WebKit.WebResource.props.uri
Name:

uri

Type:

str

Default Value:

None

Flags:

READABLE

The current active URI of the WebKit.WebResource. See WebKit.WebResource.get_uri() for more details.