from tweepy.auth import AppAuthHandler, OAuthHandler
from tweepy.cache import Cache, FileCache, MemoryCache
from tweepy.cursor import Cursor
-from tweepy.errors import HTTPException, TooManyRequests, TweepyException
+from tweepy.errors import HTTPException, NotFound, TooManyRequests, TweepyException
from tweepy.models import DirectMessage, Friendship, ModelFactory, SavedSearch, SearchResults, Status, User
from tweepy.streaming import Stream
import requests
-from tweepy.errors import HTTPException, TooManyRequests, TweepyException
+from tweepy.errors import HTTPException, NotFound, TooManyRequests, TweepyException
from tweepy.models import Model
from tweepy.parsers import ModelParser, Parser
from tweepy.utils import list_to_csv
# If an error was returned, throw an exception
self.last_response = resp
+ if resp.status_code == 404:
+ raise NotFound(resp)
if resp.status_code == 429:
raise TooManyRequests(resp)
if resp.status_code and not 200 <= resp.status_code < 300:
)
+class NotFound(HTTPException):
+ """Exception raised for a 404 HTTP status code"""
+ pass
+
+
class TooManyRequests(HTTPException):
"""Exception raised for a 429 HTTP status code"""
pass