Mixins

Downloadable

class aiogram.types.mixins.Downloadable[source]

Bases: object

Mixin for files

async download(destination=None, timeout=30, chunk_size=65536, seek=True, make_dirs=True, *, destination_dir: Optional[Union[str, Path]] = None, destination_file: Optional[Union[str, Path, IOBase]] = None)[source]

Download file

At most one of these parameters can be used: :param destination_dir:, :param destination_file:

Parameters
  • destination – deprecated, use :param destination_dir: or :param destination_file: instead

  • timeout – Integer

  • chunk_size – Integer

  • seek – Boolean - go to start of file when downloading is finished.

  • make_dirs – Make dirs if not exist

  • destination_dir – directory for saving files

  • destination_file – path to the file or instance of io.IOBase. For e. g. io.BytesIO

Returns

destination

async get_file()[source]

Get file information

Returns

aiogram.types.File

async get_url()[source]

Get file url.

Attention!! This method has security vulnerabilities for the reason that result contains bot’s access token in open form. Use at your own risk!

Returns

url