Skip to content

Exceptions

ApiError(*args, **kwargs: dict[str, any])

Bases: Exception

Class for any api errors.

Initialize an ApiError.

Functions

RateLimitError(message: str, retry_after: float = 0)

Bases: Exception

Exception raised when API rate limits are exceeded.

This exception is raised when either the per-minute (30 requests) or per-day (10,000 requests) rate limit is exceeded. The exception message includes: - Which rate limit was exceeded (minute or day) - The specific limit value - Human-readable wait time before the next request can be made

The rate limiting is enforced locally before making API requests, preventing unnecessary HTTP calls that would fail on the server side.

ATTRIBUTE DESCRIPTION
retry_after

Number of seconds to wait before the next request can be made. This allows applications to implement programmatic retry logic.

Note

Applications should catch this exception and implement appropriate retry logic or inform users about the rate limit. See the Session class documentation for examples of handling this exception.

Examples:

Python Console Session
>>> from mokkari import Session
>>> from mokkari.exceptions import RateLimitError
>>> import time
>>> session = Session("username", "password")
>>> try:
...     issue = session.issue(1)
... except RateLimitError as e:
...     # Error message format:
...     # "Rate limit exceeded: You have reached the 30 requests per minute limit.
...     #  Please wait 1 minute, 30 seconds before making another request."
...     print(f"Rate limited: {e}")
...     # Access the numeric delay value for programmatic retry
...     time.sleep(e.retry_after)

Initialize a RateLimitError.

PARAMETER DESCRIPTION
message

The error message describing the rate limit condition.

TYPE: str

retry_after

Number of seconds to wait before the next request (default: 0).

TYPE: float DEFAULT: 0

Functions

AuthenticationError()

Bases: Exception

Class for any authentication errors.

Initialize the Authentication error.

Functions

CacheError(*args, **kwargs: dict[str, any])

Bases: Exception

Class for any database cache errors.

Initialize an CacheError.

Functions