From bc895dd9843d9fef2200a8f74623bb02aae00565 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 19 Jul 2018 20:07:15 +0200 Subject: [PATCH] If the http.request plugin gets a proper JSON message as a response, then extract the Platypush message out of the original response --- platypush/plugins/http/request/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platypush/plugins/http/request/__init__.py b/platypush/plugins/http/request/__init__.py index 8003de8e5..b9bc0f597 100644 --- a/platypush/plugins/http/request/__init__.py +++ b/platypush/plugins/http/request/__init__.py @@ -1,5 +1,6 @@ import requests +from platypush.message import Message from platypush.plugins import Plugin, action class HttpRequestPlugin(Plugin): @@ -53,6 +54,12 @@ class HttpRequestPlugin(Plugin): if output == 'binary': output = response.content else: output = response.text + try: + # If the response is a Platypush JSON, extract it + output = Message.build(output) + except Exception as e: + pass + return output