MultipartInputStream

class MultipartInputStream(**properties: Any)

Superclasses: FilterInputStream, InputStream, Object

Implemented Interfaces: PollableInputStream

Constructors:

MultipartInputStream(**properties)
new(msg:Soup.Message, base_stream:Gio.InputStream) -> Soup.MultipartInputStream

Constructors

class MultipartInputStream
classmethod new(msg: Message, base_stream: InputStream) MultipartInputStream

Creates a new MultipartInputStream that wraps the InputStream obtained by sending the Message.

Reads should not be done directly through this object, use the input streams returned by next_part or its async counterpart instead.

Parameters:
  • msg – the Message the response is related to.

  • base_stream – the InputStream returned by sending the request.

Methods

class MultipartInputStream
get_headers() MessageHeaders | None

Obtains the headers for the part currently being processed.

Note that the MessageHeaders that are returned are owned by the MultipartInputStream and will be replaced when a call is made to next_part or its async counterpart, so if keeping the headers is required, a copy must be made.

Note that if a part had no headers at all an empty MessageHeaders will be returned.

next_part(cancellable: Cancellable | None = None) InputStream | None

Obtains an input stream for the next part.

When dealing with a multipart response the input stream needs to be wrapped in a MultipartInputStream and this function or its async counterpart need to be called to obtain the first part for reading.

After calling this function, get_headers can be used to obtain the headers for the first part. A read of 0 bytes indicates the end of the part; a new call to this function should be done at that point, to obtain the next part.

Parameters:

cancellable – a Cancellable

next_part_async(io_priority: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *data: Any) None

Obtains a InputStream for the next request.

See next_part for details on the workflow.

Parameters:
  • io_priority – the I/O priority for the request.

  • cancellable – a Cancellable.

  • callback – callback to call when request is satisfied.

  • data – data for callback

next_part_finish(result: AsyncResult) InputStream | None

Finishes an asynchronous request for the next part.

Parameters:

result – a AsyncResult.

Properties

class MultipartInputStream
props.message: Message

The Message.