diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 4acd4e46..961e9d10 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -55,7 +55,7 @@ async def check_result(method_name: str, content_type: str, status_code: int, bo :return: The result parsed to a JSON dictionary :raises ApiException: if one of the above listed cases is applicable """ - log.debug(f"Response for {method_name}: [{status_code}] {body}") + log.debug('Response for %s: [%d] "%r"', method_name, status_code, body) if content_type != 'application/json': raise exceptions.NetworkError(f"Invalid response with content type {content_type}: \"{body}\"") @@ -93,7 +93,9 @@ async def check_result(method_name: str, content_type: str, status_code: int, bo async def make_request(session, token, method, data=None, files=None, **kwargs): - log.debug(f"Make request: '{method}' with data: {data} and files {files}") + # log.debug(f"Make request: '{method}' with data: {data} and files {files}") + log.debug('Make request: "%s" with data: "%r" and files "%r"', method, data, files) + url = Methods.api_url(token=token, method=method) req = compose_data(data, files) diff --git a/aiogram/bot/base.py b/aiogram/bot/base.py index 1934f0ac..e37f1923 100644 --- a/aiogram/bot/base.py +++ b/aiogram/bot/base.py @@ -93,7 +93,7 @@ class BaseBot: async def request(self, method: base.String, data: Optional[Dict] = None, - files: Optional[Dict] = None) -> Union[List, Dict, base.Boolean]: + files: Optional[Dict] = None, **kwargs) -> Union[List, Dict, base.Boolean]: """ Make an request to Telegram Bot API @@ -110,7 +110,7 @@ class BaseBot: :raise: :obj:`aiogram.exceptions.TelegramApiError` """ return await api.make_request(self.session, self.__token, method, data, files, - proxy=self.proxy, proxy_auth=self.proxy_auth) + proxy=self.proxy, proxy_auth=self.proxy_auth, **kwargs) async def download_file(self, file_path: base.String, destination: Optional[base.InputFile] = None, diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index d15088ad..1b6d1451 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -92,7 +92,7 @@ class Bot(BaseBot): allowed_updates = prepare_arg(allowed_updates) payload = generate_payload(**locals()) - result = await self.request(api.Methods.GET_UPDATES, payload) + result = await self.request(api.Methods.GET_UPDATES, payload, timeout=timeout + 2 if timeout else None) return [types.Update(**update) for update in result] async def set_webhook(self, url: base.String,