X-Git-Url: https://projects.mako.cc/source/twitter-api-cdsw/blobdiff_plain/1e2d406ccc7bfaa9c73ab809367ce5ae2ab6fc79..a5afcef4759dfb5886e60791cf9b0b8fc7d67b8f:/tweepy/binder.py 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)