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 DefaultResponses(IDefaultResponses): (source)
Constructor: DefaultResponses(app, directory, engine)
Undocumented
| Static Method | __file |
Build an independent response for an available regular file. |
| Method | __contains__ |
Check if the cache contains the specified key. |
| Method | __delitem__ |
Remove an item from the memory cache by key. |
| Method | __getitem__ |
Retrieve a cached value by key. |
| Method | __init__ |
Initialize instance with application and directory dependencies. |
| Async Method | __public |
Select a public file and recover when a previously selected file vanishes. |
| Method | __refresh |
Refresh application labels and expire health bodies when they change. |
| Async Method | __render |
Render a built-in template through the application's official engine. |
| Method | __setitem__ |
Store a value in the cache with the specified key. |
| Method | asset |
Serve a whitelisted package asset without exposing arbitrary files. |
| Async Method | error |
Return an error page or JSON response for the specified status code. |
| Async Method | exception |
Render an exception page with request and traceback details. |
| Async Method | favicon |
Return the favicon file response or a 404 response if not found. |
| Async Method | health |
Render the application health state as an HTML or JSON response. |
| Async Method | robots |
Return the robots.txt file or a 404 response if not found. |
| Async Method | sitemap |
Return the public sitemap.xml file, or a 404 response when absent. |
| Constant | _ASSET |
Undocumented |
| Constant | _ASSET |
Undocumented |
| Constant | _ASSETS |
Undocumented |
| Constant | _FAVICON |
Undocumented |
| Constant | _FAVICON |
Undocumented |
| Constant | _FAVICON |
Undocumented |
| Constant | _FONT |
Undocumented |
| Constant | _GENERAL |
Undocumented |
| Constant | _HEALTH |
Undocumented |
| Constant | _NO |
Undocumented |
| Constant | _ROBOTS |
Undocumented |
| Constant | _SITEMAP |
Undocumented |
| Constant | _TEMPLATES |
Undocumented |
| Constant | ASSET |
Undocumented |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | __app |
Undocumented |
| Instance Variable | __app |
Undocumented |
| Instance Variable | __app |
Undocumented |
| Instance Variable | __asset |
Undocumented |
| Instance Variable | __directory |
Undocumented |
| Instance Variable | __engine |
Undocumented |
| Instance Variable | __memory |
Undocumented |
Build an independent response for an available regular file.
| Parameters | |
path:Path | Candidate file whose current metadata is read by FileResponse. |
headers:dict[str, str] | Fixed file headers including its content type. |
| Returns | |
FileResponse | None | New response, or None when the file is unavailable or not regular. |
Initialize instance with application and directory dependencies.
| Parameters | |
app:IApplication | The application instance providing configuration and services. |
directory:IDirectory | The directory service for accessing storage paths. |
engine:IViewEngine | Official asynchronous template rendering engine. |
| Returns | |
None | This constructor does not return a value. |
str, candidates: tuple[ tuple[ str, dict[ str, str]], ...], missing_message: str, *, fallback: tuple[ str, dict[ str, str]] | None = None) -> FileResponse | HTMLResponse:
(source)
¶
Select a public file and recover when a previously selected file vanishes.
| Parameters | |
key:str | Cache entry for the selected path and headers. |
candidates:tuple[tuple[str, dict[str, str]], ...] | Public filenames and headers in order of preference. |
missingstr | Description displayed when no candidate is available. |
fallback:tuple[str, dict[str, str]] | None, optional | Package filename and headers used when no public file exists. |
| Returns | |
FileResponse | HTMLResponse | Independent file stream or an HTML error response. |
Refresh application labels and expire health bodies when they change.
| Returns | |
None | Update the labels used by subsequent template renders. |
Serve a whitelisted package asset without exposing arbitrary files.
| Parameters | |
path:str | Exact asset name relative to the reserved asset URL prefix. |
| Returns | |
FileResponse | Response | Local asset with its fixed MIME type, or an empty 404 response. |
int | HTTPStatus, content: str | dict, *, expects_json: bool, headers: dict[ str, str] | None = None) -> HTMLResponse | JSONResponse:
(source)
¶
Return an error page or JSON response for the specified status code.
| Parameters | |
statusint | HTTPStatus | Integer HTTP status between 100 and 599. Unlisted codes use an HTTP <code> label on the HTML page. |
content:str | dict | Content of the error to display. HTML renders the description as escaped text; JSON preserves the supplied values. |
expectsbool | If True, returns a JSON response; otherwise, returns HTML. |
headers:dict[str, str] | None, optional | Additional headers to include in the response. |
| Returns | |
HTMLResponse or JSONResponse | HTMLResponse with rendered error page, or JSONResponse if expects_json is True. |
| Raises | |
TypeError | If status_code is not an integer. |
ValueError | If status_code is outside the range 100 to 599. |
str, request_method: str, exception: BaseException, status_code: int | HTTPStatus = HTTPStatus.INTERNAL_SERVER_ERROR) -> HTMLResponse:
(source)
¶
Render an exception page with request and traceback details.
| Parameters | |
requeststr | Path of the request that caused the exception. |
requeststr | HTTP method of the request that caused the exception. |
exception:BaseException | Exception instance to be rendered. |
statusint | HTTPStatus, optional | HTTP status code for the response. Defaults to 500. |
| Returns | |
HTMLResponse | Rendered exception page as an HTMLResponse with the given status code. |
Return the favicon file response or a 404 response if not found.
Searches for a favicon in the public storage directory using common favicon file names and content types. If not found, attempts to use the framework's internal fallback favicon. Caches the result for subsequent calls.
| Returns | |
FileResponse or Response | A FileResponse containing the favicon if found, otherwise a Response with status 404. |
Render the application health state as an HTML or JSON response.
| Parameters | |
request:Request | The HTTP request object. |
| Returns | |
HTMLResponse or JSONResponse | HTMLResponse with the state page content or JSONResponse with the application status. Status is 200 if healthy, 503 if under maintenance. |
Return the robots.txt file or a 404 response if not found.
Search for a robots.txt file in the public storage directory. If not found, check for a fallback file. Cache the result for future calls.
| Returns | |
FileResponse or Response | FileResponse with robots.txt if found, otherwise Response with 404. |
Return the public sitemap.xml file, or a 404 response when absent.
Retain the selected path and read its current metadata for each response.
| Returns | |
FileResponse or Response | FileResponse with sitemap.xml if found, otherwise Response with status 404. |
Undocumented
| Value |
|
Undocumented
| Value |
|
Undocumented
| Value |
|
Undocumented
| Value |
|
Undocumented
| Value |
|