Multipart

discord_http.multipart module

class discord_http.multipart.MultipartData

Bases: object

Represents multipart data for HTTP requests.

boundary

The boundary string used to separate parts in the multipart data.

Type:

str

bufs

A list of byte strings that make up the multipart data.

Type:

list[bytes]

attach(name, data, *, filename=None, content_type=None) None

Attach data to the multipart data.

Parameters:
  • name (str) – Name of the file data

  • data (File | BufferedIOBase | dict | str) – The data to attach

  • filename (str | None) – Filename to be sent on Discord

  • content_type (str | None) – The content type of the file data (Defaults to ‘application/octet-stream’ if not provided)

Return type:

None

property content_type: str

The content type of the multipart data.

finish() bytes

Return the multipart data to be sent to Discord.

Return type:

bytes