ContextDependency¶
- class controller.dependencies.context.ContextDependency¶
Bases:
object
Provide a per-request context as a FastAPI dependency.
Each request gets its own
RequestContext
. The portions of the context shared across all requests are collected into the single process-globalProcessContext
and reused with each request.Attributes Summary
Whether the process context has been initialized.
Methods Summary
__call__
(request, logger)Create a per-request context and return it.
aclose
()Clean up the per-process configuration.
initialize
(config)Initialize the process-global shared context.
Attributes Documentation
- is_initialized¶
Whether the process context has been initialized.
Methods Documentation
- async __call__(request, logger)¶
Create a per-request context and return it.
- Parameters:
request (
Request
)logger (
BoundLogger
)
- Return type: