X-Git-Url: https://jfr.im/git/z_archive/twitter.git/blobdiff_plain/afa71268458f4c96e101729cc99b3c3b1421e650..8031bb025fc77ffd0ebb7fa69fe2cf24ffe58844:/twitter/api.py diff --git a/twitter/api.py b/twitter/api.py index 6271821..6abdd97 100644 --- a/twitter/api.py +++ b/twitter/api.py @@ -1,7 +1,5 @@ import urllib2 -from exceptions import Exception - from twitter.twitter_globals import POST_ACTIONS from twitter.auth import NoAuth @@ -151,11 +149,12 @@ class TwitterCall(object): try: handle = urllib2.urlopen(req) if "json" == self.format: - res = json.loads(handle.read()) + res = json.loads(handle.read().decode('utf8')) return wrap_response(res, handle.headers) else: - return wrap_response(str(handle.read()), handle.headers) - except urllib2.HTTPError, e: + return wrap_response( + handle.read().decode('utf8'), handle.headers) + except urllib2.HTTPError as e: if (e.code == 304): return [] else: