From 71a091e0c2c8f61f473083409eff2367991a84f3 Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Sun, 8 Mar 2020 18:12:18 +0000 Subject: [PATCH] GoogleCloud: add debugging, error handling --- GoogleCloud/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GoogleCloud/plugin.py b/GoogleCloud/plugin.py index 48afd1a..401359a 100644 --- a/GoogleCloud/plugin.py +++ b/GoogleCloud/plugin.py @@ -68,7 +68,7 @@ class GoogleCloud(callbacks.Plugin): log.debug("GoogleCloud: Error accessing {0}: {1}".format(url, response.content.decode())) return result = json.loads(response.content) - if not response: + if not result.get('data'): log.debug("GoogleCloud: Error opening JSON response") return if result['data']['translations'][0].get('detectedSourceLanguage'):