Dependencies, sessions, logging, testing¶
Depends
¶
Marks a handler argument as supplied by a dependency.
Source code in python/aether/_depends.py
Sessions
¶
Sessions(
secret: str | bytes,
*,
cookie: str = "aether_session",
max_age: int = DEFAULT_MAX_AGE,
secure: bool = True,
same_site: str = "Lax",
path: str = "/",
)
Reads and writes a signed session cookie.
Source code in python/aether/_sessions.py
encode
¶
decode
¶
Return the data, or an empty dict if the cookie is not trustworthy.
Source code in python/aether/_sessions.py
middleware
async
¶
Source code in python/aether/_sessions.py
Session
¶
json_logging
¶
Send Aether's logs to stderr as JSON lines.
Source code in python/aether/_logging.py
JsonFormatter
¶
Bases: Formatter
One JSON object per line, with any extra fields included.
format
¶
Source code in python/aether/_logging.py
TestClient
¶
TestClient(
app: Any,
*,
host: str = "127.0.0.1",
port: int | None = None,
timeout: float = 10.0,
**server_options: Any,
)
Runs an app for the duration of a with block.
Source code in python/aether/testing.py
start
¶
start() -> TestClient
Source code in python/aether/testing.py
stop
¶
Drain, then disconnect.
Order matters: closing the HTTP pool first would yank connections out from under requests the server is still finishing, which is exactly what graceful shutdown exists to avoid.
Source code in python/aether/testing.py
request
¶
get
¶
post
¶
put
¶
delete
¶
head
¶
stream
¶
A streaming response, for reading an SSE feed.
websocket
¶
An open WebSocket, as an async context manager.
async with client.websocket("/ws") as ws: await ws.send("hi") assert await ws.recv() == "hi"
Source code in python/aether/testing.py
mcp
¶
One JSON-RPC call against the app's MCP endpoint.
Returns the result, or raises with the JSON-RPC error message.
Source code in python/aether/testing.py
call_tool
¶
Invoke a capability the way an agent would.