Skip to main content

Constructor

timeout applies to normal API calls. upload_timeout applies to requests that contain files. Both accept a number of seconds or a (connect, read) tuple.

Session ownership

Pass a custom session when you need shared connection settings:
The client does not close a session that you pass in. It does close the session it creates itself. Use the context manager form, or call close() when you are done:

Bot, chat, and file information

get_file() returns Telegram’s raw file metadata. In most cases you do not need to call it directly; use download_attachment().

Default download directory

current_directory controls where downloads are saved when download_path is omitted:

Helpers

convert_timestamp() accepts the Unix timestamp fields on parsed messages. It returns a formatted date string.