Update twython.py (Attribute error, unicode object detected) #165

Merged
bkvirendra merged 1 commit from patch-2 into master 2013-04-08 13:38:24 -07:00
Showing only changes of commit 6a3539882c - Show all commits

View file

@ -186,7 +186,12 @@ class Twython(object):
# why? twitter will return invalid json with an error code in the headers # why? twitter will return invalid json with an error code in the headers
json_error = False json_error = False
try: try:
try:
# try to get json
content = content.json() content = content.json()
except AttributeError:
# if unicode detected
content = json.loads(content)
except ValueError: except ValueError:
json_error = True json_error = True
content = {} content = {}