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 UnderMaintenanceMiddleware: (source)
Constructor: UnderMaintenanceMiddleware(under_maintenance, default_responses)
Reject every incoming request with 503 while in maintenance mode.
The response format (HTML or JSON) is selected by inspecting the Accept header of the incoming request via adapter.wantsJson().
| Method | __init__ |
Initialize with the maintenance flag and default response handler. |
| Async Method | handle |
Return a 503 response if the application is under maintenance. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | __default |
Undocumented |
| Instance Variable | __under |
Undocumented |
Initialize with the maintenance flag and default response handler.
| Parameters | |
underbool | True when the application is in maintenance mode. |
defaultIDefaultResponses | Handler used to build the 503 response. |
| Returns | |
None | Undocumented |
async def handle(self, adapter:
TransportAdapter, *, under_maintenance: bool | None = None) -> Response | None:
(source)
¶
Return a 503 response if the application is under maintenance.
| Parameters | |
adapter:TransportAdapter | Transport adapter providing header access and client-preference detection via wantsJson(). |
underbool | None, optional | Current application state; uses the constructor value when omitted. |
| Returns | |
Response | None | A 503 response when the application is in maintenance mode, None otherwise. |