MCPcopy
hub / github.com/fastapi/fastapi / add_task

Method add_task

fastapi/background.py:40–61  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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)

Callers 9

get_queryFunction · 0.80
send_notificationFunction · 0.80
get_queryFunction · 0.80
send_notificationFunction · 0.80
send_notificationFunction · 0.80
add_background_taskFunction · 0.80
endpointFunction · 0.80
get_context_b_bgFunction · 0.80
get_sync_context_b_bgFunction · 0.80

Calls

no outgoing calls

Tested by 4

add_background_taskFunction · 0.64
endpointFunction · 0.64
get_context_b_bgFunction · 0.64
get_sync_context_b_bgFunction · 0.64