ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Apply configured request-rate limits before dispatch.

Method __init__ Initialize the middleware with the given rate-limit configuration.
Async Method close Release an owned Redis connection pool during application shutdown.
Async Method handle Enforce the sliding-window rate limit for the incoming request.
Method isEnabled Report whether rate limiting is active for this application.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable __default_responses Predefined default responses for common HTTP errors.
Instance Variable __rate_limit_enabled Rate limit enabled obtained from cfg.rate_limit_enabled.
Instance Variable __rate_limit_requests Rate limit requests obtained from cfg.rate_limit_requests.
Instance Variable __rate_limit_window_seconds Rate limit window seconds obtained from cfg.rate_limit_window_seconds.
Instance Variable __retry_after_value Pre-render the Retry-After header value for rejection responses.
Instance Variable __store Backend storing the state needed by this service.
def __init__(self, config: dict, default_responses: IDefaultResponses): (source)

Initialize the middleware with the given rate-limit configuration.

Parameters
config:dictA dictionary whose keys must match HTTPRateLimit fields.
default_responses:orionis.http.default.contracts.responses.IDefaultResponsesPredefined default responses for common HTTP errors.
Returns
NoneConfigure the limiter and its enabled storage backend.
async def close(self): (source)

Release an owned Redis connection pool during application shutdown.

Returns
NoneLeave quota state intact while closing network resources.
async def handle(self, adapter: TransportAdapter) -> Response | None: (source)

Enforce the sliding-window rate limit for the incoming request.

Skip disabled limits and unresolved client addresses.

Parameters
adapter:orionis.http.adapters.request.contracts.transport.TransportAdapterTransport abstraction providing client IP and header negotiation helpers.
Returns
orionis.http.Response | NoneReturn 429 for exhausted quotas, 503 for Redis failures, or None when the request is allowed to proceed.
def isEnabled(self) -> bool: (source)

Report whether rate limiting is active for this application.

Returns
boolTrue when the limiter is enabled, False otherwise.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

__default_responses = (source)

Predefined default responses for common HTTP errors.

__rate_limit_enabled = (source)

Rate limit enabled obtained from cfg.rate_limit_enabled.

__rate_limit_requests = (source)

Rate limit requests obtained from cfg.rate_limit_requests.

__rate_limit_window_seconds = (source)

Rate limit window seconds obtained from cfg.rate_limit_window_seconds.

__retry_after_value = (source)

Pre-render the Retry-After header value for rejection responses.

Backend storing the state needed by this service.