BackgroundTasks
A collection of background tasks that will be called after a response has been sent to the client.
Methods
add_task()
@classmethod
def add_task(
func: Callable[P, Any],
args: P.args,
kwargs: P.kwargs
) - > None
Add a function to be called in the background after the response is sent.
Parameters
| Name | Type | Description |
|---|---|---|
| func | Callable[P, Any] | The function to call after the response is sent. It can be a regular def function or an async def function. |
| args | P.args | Positional arguments to pass to the background function. |
| kwargs | P.kwargs | Keyword arguments to pass to the background function. |
Returns
| Type | Description |
|---|---|
None |