Skip to content

Commit

Permalink
Showing response data on error
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel committed Nov 5, 2010
1 parent cc64755 commit 2c305bd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions v2/python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ def request(host, path, url_params, consumer_key, consumer_secret, token, token_
print 'Signed URL: %s\n' % (signed_url,)

# Connect
conn = urllib2.urlopen(signed_url, None)
try:
response = json.loads(conn.read())
finally:
conn.close()
conn = urllib2.urlopen(signed_url, None)
try:
response = json.loads(conn.read())
finally:
conn.close()
except urllib2.HTTPError, error:
response = json.loads(error.read())

return response

0 comments on commit 2c305bd

Please sign in to comment.