From 6a3539882caf500e1287c0f71d107a4db1a45862 Mon Sep 17 00:00:00 2001 From: Virendra Rajput Date: Mon, 8 Apr 2013 22:59:27 +0530 Subject: [PATCH] Update twython.py if unicode object is detected, convert it to json using simplejson/json --- twython/twython.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/twython/twython.py b/twython/twython.py index aff9967..afd968b 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -186,7 +186,12 @@ class Twython(object): # why? twitter will return invalid json with an error code in the headers json_error = False try: - content = content.json() + try: + # try to get json + content = content.json() + except AttributeError: + # if unicode detected + content = json.loads(content) except ValueError: json_error = True content = {}