From 2af9209005a18bf09b0150044416542d38a1654d Mon Sep 17 00:00:00 2001 From: Evgeny Petrov Date: Sun, 30 Oct 2016 13:18:17 +0300 Subject: [PATCH] Fixed KeyError when data field is None in CallbackQuery obj['data'] raises KeyError when `data` is None, while obj.get('data') returns None --- telebot/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index 953f14e..0faa38c 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -762,7 +762,7 @@ class CallbackQuery(JsonDeserializable): message = Message.de_json(obj['message']) inline_message_id = obj.get('inline_message_id') chat_instance = obj['chat_instance'] - data = obj['data'] + data = obj.get('data') game_short_name = obj.get('game_short_name') return cls(id, from_user, data, chat_instance, message, inline_message_id, game_short_name)