# 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: `tweepy.errors.TweepyException`

  Exception raised when an HTTP request fails

  New in version 4.0.

  response

    Requests Response from the Twitter API

    Type

      requests.Response

  api_errors

    The errors the Twitter API responded with, if any

    Type

      List[dict[str, Union[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: `tweepy.errors.HTTPException`

  Exception raised for a 400 HTTP status code

  New in version 4.0.

exception tweepy.errors.Unauthorized

  Bases: `tweepy.errors.HTTPException`

  Exception raised for a 401 HTTP status code

  New in version 4.0.

exception tweepy.errors.Forbidden

  Bases: `tweepy.errors.HTTPException`

  Exception raised for a 403 HTTP status code

  New in version 4.0.

exception tweepy.errors.NotFound

  Bases: `tweepy.errors.HTTPException`

  Exception raised for a 404 HTTP status code

  New in version 4.0.

exception tweepy.errors.TooManyRequests

  Bases: `tweepy.errors.HTTPException`

  Exception raised for a 429 HTTP status code

  New in version 4.0.

exception tweepy.errors.TwitterServerError

  Bases: `tweepy.errors.HTTPException`

  Exception raised for a 5xx HTTP status code

  New in version 4.0.