telegram.PassportFile

class telegram.PassportFile(file_id, file_date, file_size=None, bot=None, credentials=None, **kwargs)

Bases: telegram.base.TelegramObject

This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don’t exceed 10MB.

file_id

str – Unique identifier for this file.

file_size

int – File size.

file_date

int – Unix time when the file was uploaded.

bot

telegram.Bot – Optional. The Bot to use for instance methods.

Parameters:
  • file_id (str) – Unique identifier for this file.
  • file_size (int) – File size.
  • file_date (int) – Unix time when the file was uploaded.
  • bot (telegram.Bot, optional) – The Bot to use for instance methods.
  • **kwargs (dict) – Arbitrary keyword arguments.
get_file(timeout=None, **kwargs)

Wrapper over telegram.Bot.get_file. Will automatically assign the correct credentials to the returned telegram.File if originating from telegram.PassportData.decrypted_data.

Parameters:
  • timeout (int | float, optional) – If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool).
  • **kwargs (dict) – Arbitrary keyword arguments.
Returns:

telegram.File

Raises:

telegram.TelegramError