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
class RateLimitMiddleware: (source)
Constructor: RateLimitMiddleware(config, default_responses)
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 | is |
Report whether rate limiting is active for this application. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | __default |
Predefined default responses for common HTTP errors. |
| Instance Variable | __rate |
Rate limit enabled obtained from cfg.rate_limit_enabled. |
| Instance Variable | __rate |
Rate limit requests obtained from cfg.rate_limit_requests. |
| Instance Variable | __rate |
Rate limit window seconds obtained from cfg.rate_limit_window_seconds. |
| Instance Variable | __retry |
Pre-render the Retry-After header value for rejection responses. |
| Instance Variable | __store |
Backend storing the state needed by this service. |
Initialize the middleware with the given rate-limit configuration.
| Parameters | |
config:dict | A dictionary whose keys must match HTTPRateLimit fields. |
defaultorionis.http.default.contracts.responses.IDefaultResponses | Predefined default responses for common HTTP errors. |
| Returns | |
None | Configure the limiter and its enabled storage backend. |
Release an owned Redis connection pool during application shutdown.
| Returns | |
None | Leave quota state intact while closing network resources. |
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.TransportAdapter | Transport abstraction providing client IP and header negotiation helpers. |
| Returns | |
orionis.http.Response | None | Return 429 for exhausted quotas, 503 for Redis failures, or None when the request is allowed to proceed. |
Report whether rate limiting is active for this application.
| Returns | |
bool | True when the limiter is enabled, False otherwise. |