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

class HTTPRequestPrinter(IHTTPRequestPrinter): (source)

Constructor: HTTPRequestPrinter()

View In Hierarchy

Undocumented

Method __init__ Initialize the HTTPRequestPrinter instance.
Async Method __worker Write queued lines to stdout in the background.
Method printRequest Print a formatted HTTP request line to stdout or queue.
Method setEnabled Set whether to enable or disable console output for HTTP requests.
Async Method start Start the background print worker.
Method startTimer Capture the current high-resolution timestamp for request timing.
Async Method stop Drain remaining output and stop the background worker.
Constant HTTP_COLORS Undocumented
Constant HTTP_MIN_STATUS_CODE Undocumented
Constant STATUS_COLORS Undocumented
Instance Variable __enabled Undocumented
Instance Variable __queue Undocumented
Instance Variable __start_timer Undocumented
Instance Variable __status_icons Undocumented
Instance Variable __worker_task Undocumented
Instance Variable _flush Undocumented
Instance Variable _total_width Undocumented
Instance Variable _write Undocumented
def __init__(self): (source)

Initialize the HTTPRequestPrinter instance.

Determines terminal width, precomputes reusable ANSI-coloured strings, and prepares the async queue and worker task references.

Returns
NoneThis method does not return a value.
async def __worker(self): (source)

Write queued lines to stdout in the background.

Continuously reads lines from the internal async queue and writes them to stdout, flushing after each write to ensure immediate display.

Returns
NoneThis method does not return a value.
def printRequest(self, adapter: TransportAdapter, response: Response): (source)

Print a formatted HTTP request line to stdout or queue.

Computes the elapsed duration from start_time, builds an ANSI-coloured output line, and either enqueues it for the background worker (if start() was called) or writes directly to stdout.

Parameters
adapter:TransportAdapterThe transport adapter providing method and path information.
response:ResponseThe HTTP response object.
Returns
NoneThis method does not return a value.
def setEnabled(self, *, enabled: bool): (source)

Set whether to enable or disable console output for HTTP requests.

Parameters
enabled:boolIf True, HTTP requests are printed to console. If False, output is suppressed.
Returns
NoneThis method does not return a value.
async def start(self): (source)

Start the background print worker.

Creates the internal async queue and spawns a background task to drain queued output lines. Must be called once from an async context before the first request is handled.

Returns
NoneThis method does not return a value.
def startTimer(self) -> float | None: (source)

Capture the current high-resolution timestamp for request timing.

Returns None immediately if printing is disabled, avoiding unnecessary work when output has been suppressed via setEnabled(enabled=False).

Returns
float | NoneA high-resolution monotonic timestamp from time.perf_counter(), or None if output is disabled.
async def stop(self): (source)

Drain remaining output and stop the background worker.

Waits for every queued line to be written before cancelling the worker task. Safe to call even if start() was never invoked.

Returns
NoneThis method does not return a value.

Undocumented

Value
{'GET': (_BG_GREEN, _FG_BLACK),
 'POST': (_BG_BLUE, _FG_WHITE),
 'PUT': (_BG_YELLOW, _FG_BLACK),
 'PATCH': (_BG_MAGENTA, _FG_WHITE),
 'DELETE': (_BG_RED, _FG_WHITE),
 'OPTIONS': (_BG_CYAN, _FG_BLACK),
 'HEAD': (_BG_WHITE, _FG_BLACK),
...
HTTP_MIN_STATUS_CODE: ClassVar[int] = (source)

Undocumented

Value
100
STATUS_COLORS: ClassVar[dict] = (source)

Undocumented

Value
{'1xx': (_BG_CYAN, _FG_BLACK),
 '2xx': (_BG_GREEN, _FG_WHITE),
 '3xx': (_BG_YELLOW, _FG_BLACK),
 '4xx': (_BG_MAGENTA, _FG_WHITE),
 '5xx': (_BG_RED, _FG_WHITE),
 'default': (_BG_GREY50, _FG_WHITE)}
__enabled: bool = (source)

Undocumented

Undocumented

__start_timer: float | None = (source)

Undocumented

__status_icons: dict[str, str] = (source)

Undocumented

__worker_task: asyncio.Task | None = (source)

Undocumented

Undocumented

_total_width = (source)

Undocumented

Undocumented