from tweepy.cursor import Cursor
from tweepy.errors import (
BadRequest, Forbidden, HTTPException, NotFound, TooManyRequests,
- TweepyException, Unauthorized
+ TweepyException, TwitterServerError, Unauthorized
)
from tweepy.models import (
DirectMessage, Friendship, ModelFactory, SavedSearch, SearchResults,
from tweepy.errors import (
BadRequest, Forbidden, HTTPException, NotFound, TooManyRequests,
- TweepyException, Unauthorized
+ TweepyException, TwitterServerError, Unauthorized
)
from tweepy.models import Model
from tweepy.parsers import ModelParser, Parser
raise NotFound(resp)
if resp.status_code == 429:
raise TooManyRequests(resp)
+ if resp.status_code >= 500:
+ raise TwitterServerError(resp)
if resp.status_code and not 200 <= resp.status_code < 300:
raise HTTPException(resp)
class TooManyRequests(HTTPException):
"""Exception raised for a 429 HTTP status code"""
pass
+
+
+class TwitterServerError(HTTPException):
+ """Exception raised for a 5xx HTTP status code"""