labthings_fastapi.dependencies.blocking_portal
FastAPI dependency for a blocking portal
This allows dependencies that are called by threaded code to send things back to the async event loop.
Module Contents
Functions
Return the blocking portal from our ThingServer |
Data
A ready-made dependency type for a blocking portal. If you use an argument with
type |
API
- labthings_fastapi.dependencies.blocking_portal.blocking_portal_from_thing_server(request: fastapi.Request) anyio.from_thread.BlockingPortal
Return the blocking portal from our ThingServer
This is for use as a FastAPI dependency, to allow threaded code to call async code.
- labthings_fastapi.dependencies.blocking_portal.BlockingPortal
None
A ready-made dependency type for a blocking portal. If you use an argument with type
BlockingPortal, FastAPI will automatically inject the blocking portal. This is simply shorthand foranyio.from_thread.BlockingPortalannotated withDepends(blocking_portal_from_thing_server).