mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
Make more graceful exceptions
This commit is contained in:
parent
e66194dbf3
commit
06c509cda8
3 changed files with 79 additions and 45 deletions
|
|
@ -24,7 +24,7 @@ class BaseBot:
|
|||
|
||||
def __init__(self, token: String,
|
||||
loop: Optional[Union[asyncio.BaseEventLoop, asyncio.AbstractEventLoop]] = None,
|
||||
connections_limit: Optional[Integer] = 10, proxy=None, proxy_auth=None):
|
||||
connections_limit: Optional[Integer] = 10, proxy=None, proxy_auth=None, continue_retry=False):
|
||||
"""
|
||||
Instructions how to get Bot token is found here: https://core.telegram.org/bots#3-how-do-i-create-a-bot
|
||||
|
||||
|
|
@ -36,6 +36,7 @@ class BaseBot:
|
|||
self.__token = token
|
||||
self.proxy = proxy
|
||||
self.proxy_auth = proxy_auth
|
||||
self.continue_retry = continue_retry
|
||||
|
||||
if loop is None:
|
||||
loop = asyncio.get_event_loop()
|
||||
|
|
@ -98,7 +99,8 @@ class BaseBot:
|
|||
:raise: :class:`aiogram.exceptions.TelegramApiError`
|
||||
"""
|
||||
return await api.request(self.session, self.__token, method, data, files,
|
||||
proxy=self.proxy, proxy_auth=self.proxy_auth)
|
||||
proxy=self.proxy, proxy_auth=self.proxy_auth,
|
||||
continue_retry=self.continue_retry)
|
||||
|
||||
async def download_file(self, file_path: String,
|
||||
destination: Optional[InputFile] = None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue