Added browser sessions and protected route support.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 2m48s
CI / Tests (Python 3.13) (push) Successful in 2m49s
CI / Tests (Python 3.14) (push) Successful in 2m43s
CI / Type Checking (push) Successful in 9s
CI / Spelling (push) Successful in 5s

This commit is contained in:
2026-05-04 21:01:57 -04:00
parent f22d73857b
commit 5443aa86ce
22 changed files with 2057 additions and 57 deletions
+15 -1
View File
@@ -39,6 +39,9 @@ class RouteMark(TypedDict):
path: str
methods: list[str] | None
streaming: bool
requires_session: bool
requires_authenticated: bool
requires_moderator: bool
# Handler type: receives RouteContext, returns a response or dict (auto-JSON).
@@ -57,6 +60,9 @@ class RouteInfo:
handler: RouteHandler
module_name: str
streaming: bool = False
requires_session: bool = False
requires_authenticated: bool = False
requires_moderator: bool = False
def on_route(
@@ -64,6 +70,9 @@ def on_route(
*,
methods: list[str] | None = None,
streaming: bool = False,
requires_session: bool = False,
requires_authenticated: bool = False,
requires_moderator: bool = False,
) -> Callable[[RouteHandler], RouteHandler]:
"""Register an HTTP route handler.
@@ -81,7 +90,12 @@ def on_route(
# methods=None is resolved to ["GET"] by RouteRegistry.register().
# Framework decorator marker; private to module authors.
func._owlbot_route = RouteMark( # type: ignore[attr-defined] # noqa: SLF001
path=path, methods=methods, streaming=streaming
path=path,
methods=methods,
streaming=streaming,
requires_session=requires_session,
requires_authenticated=requires_authenticated,
requires_moderator=requires_moderator,
)
return func