Skip to content

Errors

TwitchException

Bases: Exception

Base exception for twitch.py.


ClientException

Bases: TwitchException

Exception raised when an operation in the Client class fails.


HTTPException

Bases: TwitchException

Exception raised for failed HTTP requests to the Twitch API.

Attributes:

Name Type Description
response ClientResponse

The original aiohttp response object.

status int

The HTTP status code of the response.

code int or str

The Twitch API-specific error code, if available.

text str

The error message or description.

headers dict

The response headers from aiohttp.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


TwitchServerError

Bases: HTTPException

Exception raised when a 500 range status code occurs.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


Forbidden

Bases: HTTPException

Exception raised when status code 403 occurs.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


NotFound

Bases: HTTPException

Exception raised when status code 404 occurs.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


RateLimited

Bases: HTTPException

Exception raised when rate limited and max timeout exceeded.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


BadRequest

Bases: HTTPException

Exception raised when status code 400 occurs.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


Unauthorized

Bases: HTTPException

Exception raised when status code 401 occurs.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


AuthFailure

Bases: ClientException

Exception raised when authentication fails, typically due to invalid credentials.


Conflict

Bases: HTTPException

Exception raised when status code 409 occurs.

is_client_error()

Check if this is a client error (4xx status code).

is_server_error()

Check if this is a server error (5xx status code).


TokenError

Bases: ClientException

Exception raised when there are token-related issues.