Multipart
- class Multipart(**kwargs)
- Constructors:
new(mime_type:str) -> Soup.Multipart
new_from_message(headers:Soup.MessageHeaders, body:GLib.Bytes) -> Soup.Multipart or None
Constructors
- class Multipart
Methods
- class Multipart
- append_form_file(control_name: str, filename: str | None, content_type: str | None, body: Bytes) None
Adds a new MIME part containing
body
tomultipart
Uses “Content-Disposition: form-data”, as per the HTML forms specification.
- Parameters:
control_name – the name of the control associated with this file
filename – the name of the file, or
None
if not knowncontent_type – the MIME type of the file, or
None
if not knownbody – the file data
- append_form_string(control_name: str, data: str) None
Adds a new MIME part containing
data
tomultipart
.Uses “Content-Disposition: form-data”, as per the HTML forms specification.
- Parameters:
control_name – the name of the control associated with
data
data – the body data
- append_part(headers: MessageHeaders, body: Bytes) None
Adds a new MIME part to
multipart
with the given headers and body.(The multipart will make its own copies of
headers
andbody
, so you should free your copies if you are not using them for anything else.)- Parameters:
headers – the MIME part headers
body – the MIME part body
- get_part(part: int) tuple[bool, MessageHeaders, Bytes]
Gets the indicated body part from
multipart
.- Parameters:
part – the part number to get (counting from 0)
- to_message(dest_headers: MessageHeaders) Bytes
Serializes
multipart
todest_headers
anddest_body
.- Parameters:
dest_headers – the headers of the HTTP message to serialize
multipart
to