From 0ecaed673c379972d360b2876d33c0112b6da520 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Thu, 13 Jun 2013 13:51:04 +0200 Subject: [PATCH] Add more info when JSON return is not in JSON format --- twitterclient.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/twitterclient.py b/twitterclient.py index 01a7d33..0a54ec5 100644 --- a/twitterclient.py +++ b/twitterclient.py @@ -55,7 +55,12 @@ class TwitterClient(object): # Make the actual call to twitter ret=instream.read() instream.close() - return json.loads(ret) + try: + return json.loads(ret) + except json.decoder.JSONDecodeError: + print "Received non-JSON response to a JSON request!" + print ret + raise def list_subscribers(self): # Eek. It seems subscribers are paged even if we don't ask for it -- 2.39.5