InputFile#

class aiogram.types.input_file.InputFile(filename: str | None = None, chunk_size: int = 65536)[source]#

This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.

Source: https://core.telegram.org/bots/api#inputfile

abstract async read(bot: Bot) AsyncGenerator[bytes, None][source]#
class aiogram.types.input_file.BufferedInputFile(file: bytes, filename: str, chunk_size: int = 65536)[source]#
classmethod from_file(path: str | Path, filename: str | None = None, chunk_size: int = 65536) BufferedInputFile[source]#

Create buffer from file

Параметри:
  • path – Path to file

  • filename – Filename to be propagated to telegram. By default, will be parsed from path

  • chunk_size – Uploading chunk size

Повертає:

instance of BufferedInputFile

async read(bot: Bot) AsyncGenerator[bytes, None][source]#
class aiogram.types.input_file.FSInputFile(path: str | Path, filename: str | None = None, chunk_size: int = 65536)[source]#
async read(bot: Bot) AsyncGenerator[bytes, None][source]#
class aiogram.types.input_file.URLInputFile(url: str, headers: Dict[str, Any] | None = None, filename: str | None = None, chunk_size: int = 65536, timeout: int = 30, bot: 'Bot' | None = None)[source]#
async read(bot: Bot) AsyncGenerator[bytes, None][source]#