Handle failures during send of request to twitter. This mainly happens if we are...
authorJosh Roesslein <jroesslein@gmail.com>
Thu, 15 Oct 2009 18:33:19 +0000 (13:33 -0500)
committerJosh Roesslein <jroesslein@gmail.com>
Thu, 15 Oct 2009 18:33:19 +0000 (13:33 -0500)
tweepy/binder.py

index 5728962c1b4b99866da2628d31b0e23eaf8ab74a..0175bd4785d07d5525f00f3b4c549d63b3f44e84 100644 (file)
@@ -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()