InputFile

class aiogram.types.input_file.InputFile(path_or_bytesio: Union[str, io.IOBase, pathlib.Path], filename=None, conf=None)[source]

Bases: aiogram.types.base.TelegramObject

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.

Also that is not typical TelegramObject!

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

Parameters
  • path_or_bytesio

  • filename

  • conf

get_filename() → str[source]

Get file name

Returns

name

get_file()[source]

Get file object

Returns

classmethod from_url(url, filename=None, chunk_size=65536)[source]

Download file from URL

Manually is not required action. You can send urls instead!

Parameters
  • url – target URL

  • filename – optional. set custom file name

  • chunk_size

Returns

InputFile

save(filename, chunk_size=65536)[source]

Write file to disk

Parameters
  • filename

  • chunk_size

to_python()[source]

Get object as JSON serializable

Returns

classmethod to_object(data)[source]

Deserialize object

Parameters

data

Returns