X-Git-Url: https://projects.mako.cc/source/twitter-api-cdsw/blobdiff_plain/043b63c67557591f1e85b53d17fc8a1a797f48ca..4b0f484cf92d3dd4a04eff17a3c52e2dd1dde9b1:/tweepy/binder.py?ds=inline diff --git a/tweepy/binder.py b/tweepy/binder.py index 2ac6146..ba55570 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -12,7 +12,7 @@ import requests import logging -from tweepy.error import TweepError +from tweepy.error import TweepError, RateLimitError, is_rate_limit_error_message from tweepy.utils import convert_to_utf8_str from tweepy.models import Model @@ -220,7 +220,11 @@ def bind_api(**config): error_msg = self.parser.parse_error(resp.text) except Exception: error_msg = "Twitter error response: status code = %s" % resp.status_code - raise TweepError(error_msg, resp) + + if is_rate_limit_error_message(error_msg): + raise RateLimitError(error_msg, resp) + else: + raise TweepError(error_msg, resp) # Parse the response payload result = self.parser.parse(self, resp.text)