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).
This commit is contained in:
@ -268,7 +268,9 @@ class Tautulli:
|
|||||||
try:
|
try:
|
||||||
response_json = response.json()
|
response_json = response.json()
|
||||||
except ValueError:
|
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
|
return
|
||||||
|
|
||||||
if response_json['response']['result'] == 'success':
|
if response_json['response']['result'] == 'success':
|
||||||
|
Reference in New Issue
Block a user