From 01c5bbadcda251e99fa3cb2f6acbb9ebf9bfb82b Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 13 May 2018 11:49:42 +0200 Subject: [PATCH] Type should actually always be there --- platypush/backend/pushbullet/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platypush/backend/pushbullet/__init__.py b/platypush/backend/pushbullet/__init__.py index 8a51364f2..61637bb0b 100644 --- a/platypush/backend/pushbullet/__init__.py +++ b/platypush/backend/pushbullet/__init__.py @@ -51,8 +51,7 @@ class PushbulletBackend(Backend): if not isinstance(msg, dict): return True # We received something weird is_duplicate=False - msgtype = msg['type'] if 'type' in msg else 'notype' - last_msg = self._last_received_msg[msgtype] + last_msg = self._last_received_msg[msg['type']] if last_msg: msg = Message.parse(msg) @@ -63,7 +62,7 @@ class PushbulletBackend(Backend): logging.debug('Ignoring duplicate message received on the socket') is_duplicate = True - self._last_received_msg[msgtype] = { + self._last_received_msg[msg['type']] = { 'body': msg, 'time': time.time() }