URISchemeRequest#

class URISchemeRequest(**properties: Any)#

Superclasses: Object

Represents a URI scheme request.

If you register a particular URI scheme in a WebContext, using register_uri_scheme(), you have to provide a URISchemeRequestCallback. After that, when a URI request is made with that particular scheme, your callback will be called. There you will be able to access properties such as the scheme, the URI and path, and the WebView that initiated the request, and also finish the request with finish().

Methods#

class URISchemeRequest
finish(stream: InputStream, stream_length: int, content_type: str | None = None) None#

Finish a URISchemeRequest by setting the contents of the request and its mime type.

Parameters:
  • stream – a InputStream to read the contents of the request

  • stream_length – the length of the stream or -1 if not known

  • content_type – the content type of the stream or None if not known

finish_error(error: GError) None#

Finish a URISchemeRequest with a Error.

Added in version 2.2.

Parameters:

error – a Error that will be passed to the WebView

finish_with_response(response: URISchemeResponse) None#

Finish a URISchemeRequest by returning a URISchemeResponse

Added in version 2.36.

Parameters:

response – a URISchemeResponse

get_http_body() InputStream#

Get the request body.

Added in version 2.40.

get_http_headers() MessageHeaders#

Get the MessageHeaders of the request.

Added in version 2.36.

get_http_method() str#

Get the HTTP method of the request.

Added in version 2.36.

get_path() str#

Get the URI path of request.

get_scheme() str#

Get the URI scheme of request.

get_uri() str#

Get the URI of request.

get_web_view() WebView#

Get the WebView that initiated the request.