Exceptions
Exceptions are available directly in the tweepy
module, which means
tweepy.errors
itself does not need to be imported. For example,
tweepy.errors.TweepyException
is available as
tweepy.TweepyException
.
- exception tweepy.errors.TweepyException
Bases:
Exception
Base exception for Tweepy
New in version 4.0.
- exception tweepy.errors.HTTPException
Bases:
TweepyException
Exception raised when an HTTP request fails
New in version 4.0.
Changed in version 4.10:
response
attribute can be an instance ofaiohttp.ClientResponse
- response
Requests Response from the Twitter API
- Type
requests.Response | aiohttp.ClientResponse
- api_errors
The errors the Twitter API responded with, if any
- Type
list[dict[str, int | str]]
- api_codes
The error codes the Twitter API responded with, if any
- Type
list[int]
- api_messages
The error messages the Twitter API responded with, if any
- Type
list[str]
- exception tweepy.errors.BadRequest
Bases:
HTTPException
Exception raised for a 400 HTTP status code
New in version 4.0.
- exception tweepy.errors.Unauthorized
Bases:
HTTPException
Exception raised for a 401 HTTP status code
New in version 4.0.
- exception tweepy.errors.Forbidden
Bases:
HTTPException
Exception raised for a 403 HTTP status code
New in version 4.0.
- exception tweepy.errors.NotFound
Bases:
HTTPException
Exception raised for a 404 HTTP status code
New in version 4.0.
- exception tweepy.errors.TooManyRequests
Bases:
HTTPException
Exception raised for a 429 HTTP status code
New in version 4.0.
- exception tweepy.errors.TwitterServerError
Bases:
HTTPException
Exception raised for a 5xx HTTP status code
New in version 4.0.