From: Josh Roesslein Date: Thu, 15 Oct 2009 18:33:19 +0000 (-0500) Subject: Handle failures during send of request to twitter. This mainly happens if we are... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=915676582b0dc1fd4e3132e13de7312a23438ebf;p=tweepy.git Handle failures during send of request to twitter. This mainly happens if we are unable to connect to twitter due to network outage or twitter being offline. --- diff --git a/tweepy/binder.py b/tweepy/binder.py index 5728962..0175bd4 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -110,7 +110,10 @@ def bind_api(path, parser, allowed_param=[], method='GET', require_auth=False, ) # Build request - conn.request(method, url, headers=headers, body=post_data) + try: + conn.request(method, url, headers=headers, body=post_data) + except Exception, e: + raise TweepError('Failed to send request: %s' % e) # Get response resp = conn.getresponse()