from tweepy.cache import Cache, FileCache, MemoryCache
from tweepy.cursor import Cursor
from tweepy.errors import (
- Forbidden, HTTPException, NotFound, TooManyRequests, TweepyException,
- Unauthorized
+ BadRequest, Forbidden, HTTPException, NotFound, TooManyRequests,
+ TweepyException, Unauthorized
)
from tweepy.models import (
DirectMessage, Friendship, ModelFactory, SavedSearch, SearchResults,
import requests
from tweepy.errors import (
- Forbidden, HTTPException, NotFound, TooManyRequests, TweepyException,
- Unauthorized
+ BadRequest, Forbidden, HTTPException, NotFound, TooManyRequests,
+ TweepyException, Unauthorized
)
from tweepy.models import Model
from tweepy.parsers import ModelParser, Parser
# If an error was returned, throw an exception
self.last_response = resp
+ if resp.status_code == 400:
+ raise BadRequest(resp)
if resp.status_code == 401:
raise Unauthorized(resp)
if resp.status_code == 403:
)
+class BadRequest(HTTPException):
+ """Exception raised for a 400 HTTP status code"""
+ pass
+
+
class Unauthorized(HTTPException):
"""Exception raised for a 401 HTTP status code"""
pass