From adb472da7f215bc7507e34be1ec69a4fb4a2e3d7 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 12 Mar 2021 20:52:01 +0100 Subject: [PATCH] Messages should always be posted to the Redis bus in valid JSON format - no need for ast.literal_eval fallback --- platypush/bus/redis.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/platypush/bus/redis.py b/platypush/bus/redis.py index 3dc48a5a..4a13db25 100644 --- a/platypush/bus/redis.py +++ b/platypush/bus/redis.py @@ -1,5 +1,3 @@ -import ast -import json import logging import threading @@ -39,13 +37,7 @@ class RedisBus(Bus): if not msg or msg[1] is None: return - msg = msg[1].decode('utf-8') - try: - msg = json.loads(msg) - except json.decoder.JSONDecodeError: - msg = ast.literal_eval(msg) - - msg = Message.build(msg) + msg = Message.build(msg[1].decode('utf-8')) except Exception as e: logger.exception(e)