Add a function to be called in the background after the response is sent. Read more about it in the [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/).
(
self,
func: Annotated[
Callable[P, Any],
Doc(
"""
The function to call after the response is sent.
It can be a regular `def` function or an `async def` function.
"""
),
],
*args: P.args,
**kwargs: P.kwargs,
)
| 38 | """ |
| 39 | |
| 40 | def add_task( |
| 41 | self, |
| 42 | func: Annotated[ |
| 43 | Callable[P, Any], |
| 44 | Doc( |
| 45 | """ |
| 46 | The function to call after the response is sent. |
| 47 | |
| 48 | It can be a regular `def` function or an `async def` function. |
| 49 | """ |
| 50 | ), |
| 51 | ], |
| 52 | *args: P.args, |
| 53 | **kwargs: P.kwargs, |
| 54 | ) -> None: |
| 55 | """ |
| 56 | Add a function to be called in the background after the response is sent. |
| 57 | |
| 58 | Read more about it in the |
| 59 | [FastAPI docs for Background Tasks](https://fastapi.tiangolo.com/tutorial/background-tasks/). |
| 60 | """ |
| 61 | return super().add_task(func, *args, **kwargs) |
no outgoing calls