Added hack for the response type not being set

This commit is contained in:
Rudi Grinberg 2012-10-31 11:33:42 -04:00
parent 18d6cd7868
commit 474f5aba48
1 changed files with 4 additions and 1 deletions

View File

@ -83,7 +83,10 @@ class ApiRequest(object):
if _post_data is not None: _post_data = urllib.urlencode(_post_data)
req = urllib2.Request(final_url, _post_data)
response = urllib2.urlopen(req).read()
return json.loads(response)
# Ghetto hack for now because we don't the content type we are getting
# (Pointless to look at mime since it's not being set correctly always)
try: return json.loads(response)
except ValueError: return response
class RequestProvider(object):
""" Creates the available ApiRequest instance that can be read from