:right-sidebar: True WebResource =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: WebResource(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: WebResource(**properties) Methods ------- .. rst-class:: interim-class .. class:: WebResource :no-index: .. method:: get_data(cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None Asynchronously get the raw data for ``resource``. When the operation is finished, ``callback`` will be called. You can then call :func:`~gi.repository.WebKit.WebResource.get_data_finish` to get the result of the operation. :param cancellable: a :obj:`~gi.repository.Gio.Cancellable` or :const:`None` to ignore :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when the request is satisfied :param user_data: the data to pass to callback function .. method:: get_data_finish(result: ~gi.repository.Gio.AsyncResult) -> bytes Finish an asynchronous operation started with :func:`~gi.repository.WebKit.WebResource.get_data`. :param result: a :obj:`~gi.repository.Gio.AsyncResult` .. method:: get_response() -> ~gi.repository.WebKit.URIResponse Retrieves the :obj:`~gi.repository.WebKit.URIResponse` of the resource load operation. This method returns :const:`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. .. method:: get_uri() -> str Returns the current active URI of ``resource``. 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, :obj:`~gi.repository.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, :obj:`~gi.repository.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 ``resource``. Properties ---------- .. rst-class:: interim-class .. class:: WebResource :no-index: .. attribute:: props.response :type: ~gi.repository.WebKit.URIResponse The :obj:`~gi.repository.WebKit.URIResponse` associated with this resource. .. attribute:: props.uri :type: str The current active URI of the :obj:`~gi.repository.WebKit.WebResource`. See :func:`~gi.repository.WebKit.WebResource.get_uri` for more details. Signals ------- .. rst-class:: interim-class .. class:: WebResource.signals :no-index: .. method:: failed(error: ~gi.repository.GLib.GError) -> None This signal is emitted when an error occurs during the resource load operation. :param error: the :obj:`~gi.repository.GLib.Error` that was triggered .. method:: failed_with_tls_errors(certificate: ~gi.repository.Gio.TlsCertificate, errors: ~gi.repository.Gio.TlsCertificateFlags) -> None This signal is emitted when a TLS error occurs during the resource load operation. .. versionadded:: 2.8 :param certificate: a :obj:`~gi.repository.Gio.TlsCertificate` :param errors: a :obj:`~gi.repository.Gio.TlsCertificateFlags` with the verification status of ``certificate`` .. method:: finished() -> None This signal is emitted when the resource load finishes successfully or due to an error. In case of errors :obj:`~gi.repository.WebKit.WebResource`::failed signal is emitted before this one. .. method:: sent_request(request: ~gi.repository.WebKit.URIRequest, redirected_response: ~gi.repository.WebKit.URIResponse) -> None 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. :param request: a :obj:`~gi.repository.WebKit.URIRequest` :param redirected_response: a :obj:`~gi.repository.WebKit.URIResponse`, or :const:`None`