URISchemeResponse#

class URISchemeResponse(**properties: Any)#

Superclasses: Object

Represents a URI scheme response.

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 response is made with that particular scheme, your callback will be called. There you will be able to provide more response parameters when the methods and properties of a URISchemeRequest is not enough.

When you finished setting up your URISchemeResponse, call webkit_uri_request_finish_with_response() with it to return the response.

Constructors#

class URISchemeResponse
classmethod new(input_stream: InputStream, stream_length: int) URISchemeResponse#

Create a new URISchemeResponse

Added in version 2.36.

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

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

Methods#

class URISchemeResponse
set_content_type(content_type: str) None#

Sets the content type for the response

Added in version 2.36.

Parameters:

content_type – the content type of the stream

set_http_headers(headers: MessageHeaders) None#

Assign the provided MessageHeaders to the response.

headers need to be of the type %SOUP_MESSAGE_HEADERS_RESPONSE. Any existing headers will be overwritten.

Added in version 2.36.

Parameters:

headers – the HTTP headers to be set

set_status(status_code: int, reason_phrase: str | None = None) None#

Sets the status code and reason phrase for the response.

If status_code is a known value and reason_phrase is None, the reason_phrase will be set automatically.

Added in version 2.36.

Parameters:
  • status_code – the HTTP status code to be returned

  • reason_phrase – a reason phrase

Properties#

class URISchemeResponse
props.stream: InputStream#

The type of the None singleton.

Added in version 2.36.

props.stream_length: int#

The type of the None singleton.

Added in version 2.36.