From 1e1becd88e2d5954590a02f8a1aeb1464af4cdad Mon Sep 17 00:00:00 2001 From: Nikita <43146729+gabbhack@users.noreply.github.com> Date: Sun, 12 May 2019 11:40:44 +0500 Subject: [PATCH] Make check_result func sync --- aiogram/bot/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 051ae37f..60dbc36a 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -34,7 +34,7 @@ def check_token(token: str) -> bool: return True -async def check_result(method_name: str, content_type: str, status_code: int, body: str): +def check_result(method_name: str, content_type: str, status_code: int, body: str): """ Checks whether `result` is a valid API response. A result is considered invalid if: @@ -95,7 +95,7 @@ async def make_request(session, token, method, data=None, files=None, **kwargs): req = compose_data(data, files) try: async with session.post(url, data=req, **kwargs) as response: - return await check_result(method, response.content_type, response.status, await response.text()) + return check_result(method, response.content_type, response.status, await response.text()) except aiohttp.ClientError as e: raise exceptions.NetworkError(f"aiohttp client throws an error: {e.__class__.__name__}: {e}")