Errors

class xanax.errors.XanaxError(message)[source]

Bases: Exception

Base exception for all xanax errors.

This is the parent class for all library-specific exceptions.

__init__(message)[source]
class xanax.errors.AuthenticationError(message='Authentication failed. Check your API key.')[source]

Bases: XanaxError

Raised when authentication fails.

This includes: - 401 HTTP responses - Missing API key when accessing NSFW content - Invalid API key

__init__(message='Authentication failed. Check your API key.')[source]
class xanax.errors.RateLimitError(message='Rate limit exceeded. Please wait before making more requests.', retry_after=None)[source]

Bases: XanaxError

Raised when API rate limit is exceeded.

The API allows 45 requests per minute. When exceeded, a 429 response is returned with retry information.

__init__(message='Rate limit exceeded. Please wait before making more requests.', retry_after=None)[source]
class xanax.errors.NotFoundError(message='Resource not found.')[source]

Bases: XanaxError

Raised when a requested resource is not found.

This typically corresponds to a 404 HTTP response.

__init__(message='Resource not found.')[source]
class xanax.errors.ValidationError(message)[source]

Bases: XanaxError

Raised when request parameters are invalid.

This includes: - Using topRange without toplist sorting - Invalid resolution format - Invalid ratio format - Other parameter validation failures

__init__(message)[source]
class xanax.errors.APIError(message, status_code)[source]

Bases: XanaxError

Raised for unexpected API errors.

This catches any other HTTP errors that don’t fit the specific categories above. Includes the HTTP status code for debugging.

__init__(message, status_code)[source]