From 66ac37b34eec1bf985300647b3479096a795981f Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Sun, 27 Oct 2019 20:04:36 -0700 Subject: [PATCH] Print raw response when JSON fails to parse If the response to the Tautulli API fails to parse correctly include the raw output in the message to make it easier to diagnose when the response isn't actually raw JSON from a Tautulli server (e.g. a proxy server). --- killstream/kill_stream.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/killstream/kill_stream.py b/killstream/kill_stream.py index 8f99e21..3ca994d 100644 --- a/killstream/kill_stream.py +++ b/killstream/kill_stream.py @@ -268,7 +268,9 @@ class Tautulli: try: response_json = response.json() except ValueError: - print("Failed to parse json response for Tautulli API cmd '{}'".format(cmd)) + print( + "Failed to parse json response for Tautulli API cmd '{}': {}" + .format(cmd, response.content)) return if response_json['response']['result'] == 'success':