raito.utils.helpers.retry_method module¶
- async raito.utils.helpers.retry_method.retry_method(func, *args, **kwargs)[исходный код]¶
Call an async function and retry it on Telegram errors.
Pass the coroutine function together with its arguments.
Example:
await rt.retry(bot.send_message, chat_id, "text") await rt.retry(message.answer, "text")
Retries on
TelegramRetryAfter(honouring the server-providedretry_after) and on network/server errors (TelegramNetworkError,TelegramServerError) using exponential delay. Any other exception is raised immediately.- Параметры:
- Результат:
Result of the func.
- Исключение:
Exception – If all attempts fail or a non-RetryAfter exception is raised.
- Тип результата:
T
Устарело, начиная с версии 1.6.0: Passing an already-created coroutine (
rt.retry(bot.send_message(...))) is deprecated and will stop working in 1.8.0. It is awaited only once and cannot be retried. Pass the function and its arguments instead:rt.retry(bot.send_message, chat_id, text).