GoogleCloud: add debugging, error handling

This commit is contained in:
oddluck 2020-03-08 18:12:18 +00:00
parent 6528ab0892
commit 71a091e0c2

View File

@ -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'):