import urllib2
-from exceptions import Exception
-
from twitter.twitter_globals import POST_ACTIONS
from twitter.auth import NoAuth
def wrap_response(response, headers):
response_typ = type(response)
- class WrappedTwitterResponse(TwitterResponse, response_typ):
+ if response_typ is bool:
+ # HURF DURF MY NAME IS PYTHON AND I CAN'T SUBCLASS bool.
+ response_typ = int
+
+ class WrappedTwitterResponse(response_typ, TwitterResponse):
__doc__ = TwitterResponse.__doc__
- def __init__(self, response, headers):
- response_typ.__init__(self, response)
+ def __init__(self, response):
+ if response_typ is not int:
+ response_typ.__init__(self, response)
TwitterResponse.__init__(self, headers)
- return WrappedTwitterResponse(response, headers)
+ return WrappedTwitterResponse(response)
res = json.loads(handle.read())
return wrap_response(res, handle.headers)
else:
- return wrap_response(handle.read(), handle.headers)
+ return wrap_response(str(handle.read()), handle.headers)
except urllib2.HTTPError, e:
if (e.code == 304):
return []