From 915676582b0dc1fd4e3132e13de7312a23438ebf Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Thu, 15 Oct 2009 13:33:19 -0500 Subject: [PATCH] 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. --- tweepy/binder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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() -- 2.25.1