From 2f20d70e891286a28868278c61bc2c0cc33e3c86 Mon Sep 17 00:00:00 2001 From: Pavel K Date: Sat, 4 Jun 2016 21:18:09 +0500 Subject: [PATCH] unicode strings for check_json --- telebot/types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index adf37e1..3dba678 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -62,9 +62,14 @@ class JsonDeserializable: :param json_type: :return: """ + try: + str_types = (str, unicode) + except NameError: + str_types = (str,) + if type(json_type) == dict: return json_type - elif type(json_type) == str: + elif type(json_type) in str_types: return json.loads(json_type) else: raise ValueError("json_type should be a json dict or string.")