From 1e6361dd5711a85dc3c6662fb540aac621f7f346 Mon Sep 17 00:00:00 2001 From: Pieter Date: Tue, 6 Oct 2015 22:36:57 +0200 Subject: [PATCH] Fix #83 Added a `encode('utf8')` statement to support non-ASCII symbols in error log messages. --- telebot/apihelper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 3c8c529..4c0afb8 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -43,14 +43,14 @@ def _check_result(method_name, result): """ if result.status_code != 200: msg = 'The server returned HTTP {0} {1}. Response body:\n[{2}]'\ - .format(result.status_code, result.reason, result.text) + .format(result.status_code, result.reason, result.text.encode('utf8')) raise ApiException(msg, method_name, result) try: result_json = result.json() except: msg = 'The server returned an invalid JSON response. Response body:\n[{0}]'\ - .format(result.text) + .format(result.text.encode('utf8')) raise ApiException(msg, method_name, result) if not result_json['ok']: