telegram.error module

This module contains an object that represents Telegram errors.

exception telegram.error.BadRequest(message)

Bases: telegram.error.NetworkError

Raised when Telegram could not process the request correctly.

exception telegram.error.ChatMigrated(new_chat_id)

Bases: telegram.error.TelegramError

Raised when the requested group chat migrated to supergroup and has a new chat id.

Parameters

new_chat_id (int) – The new chat id of the group.

new_chat_id
exception telegram.error.Conflict(message)

Bases: telegram.error.TelegramError

Raised when a long poll or webhook conflicts with another one.

exception telegram.error.InvalidToken

Bases: telegram.error.TelegramError

Raised when the token is invalid.

exception telegram.error.NetworkError(message)

Bases: telegram.error.TelegramError

Base class for exceptions due to networking errors.

exception telegram.error.RetryAfter(retry_after)

Bases: telegram.error.TelegramError

Raised when flood limits where exceeded.

Parameters

retry_after (int) – Time in seconds, after which the bot can retry the request.

retry_after
exception telegram.error.TelegramError(message)

Bases: Exception

Base class for Telegram errors.

message
exception telegram.error.TimedOut

Bases: telegram.error.NetworkError

Raised when a request took too long to finish.

exception telegram.error.Unauthorized(message)

Bases: telegram.error.TelegramError

Raised when the bot has not enough rights to perform the requested action.