python_template_server.routers¶
Routers for the FastAPI server.
- class python_template_server.routers.BaseRouter(prefix)[source]¶
Abstract base class for API routers.
- configure(hashed_token, limiter, rate_limit)[source]¶
Configure the router with shared dependencies.
- add_route(endpoint, handler_function, response_model, methods, limited, authentication_required)[source]¶
Add an API route.
- Parameters:
endpoint (
str) – The API endpoint pathhandler_function (
Callable) – The handler function for the endpointresponse_model (
type[BaseModel] |None) – The Pydantic model for the responselimited (
bool) – Whether to apply rate limiting to this routeauthentication_required (
bool) – Whether authentication is required for this route
- Return type:
- class python_template_server.routers.TemplateServerRouter(prefix)[source]¶
Router for the template server with health and login endpoints.
- async get_health(request)[source]¶
Get server health.
- Parameters:
request (
Request) – The incoming HTTP request- Return GetHealthResponse:
Health status response
- Raises:
HTTPException – If the server token is not configured
- Return type:
Modules
Base router for the FastAPI server. |
|
Template server router with health and login endpoints. |