mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Fix #83
Added a `encode('utf8')` statement to support non-ASCII symbols in error log messages.
This commit is contained in:
parent
ca2019b8f1
commit
1e6361dd57
@ -43,14 +43,14 @@ def _check_result(method_name, result):
|
|||||||
"""
|
"""
|
||||||
if result.status_code != 200:
|
if result.status_code != 200:
|
||||||
msg = 'The server returned HTTP {0} {1}. Response body:\n[{2}]'\
|
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)
|
raise ApiException(msg, method_name, result)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result_json = result.json()
|
result_json = result.json()
|
||||||
except:
|
except:
|
||||||
msg = 'The server returned an invalid JSON response. Response body:\n[{0}]'\
|
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)
|
raise ApiException(msg, method_name, result)
|
||||||
|
|
||||||
if not result_json['ok']:
|
if not result_json['ok']:
|
||||||
|
Loading…
Reference in New Issue
Block a user