From e61d675693df9307c82506ccb4272ddd23a0b655 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 26 Mar 2017 12:02:59 +0200 Subject: [PATCH] fix error logs --- telegram.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telegram.py b/telegram.py index 5a5a641c..fb9db66d 100644 --- a/telegram.py +++ b/telegram.py @@ -141,7 +141,8 @@ class Bot: async with session.request("GET", f"https://api.telegram.org/bot{token}/{endpoint}", params=params) as response: # Check for errors in the request if response.status != 200: - raise TelegramAPIError(f"Request returned {response.status} {response.reason}\n{response.text()}") + error = await response.text() + raise TelegramAPIError(f"Request returned {response.status} {response.reason}\n{error}") # Parse the json data as soon it's ready data = await response.json() # Check for errors in the response