Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for BackgroundTasks (0.68 sec)

  1. docs/en/docs/tutorial/background-tasks.md

    ## Using `BackgroundTasks` { #using-backgroundtasks }
    
    First, import `BackgroundTasks` and define a parameter in your *path operation function* with a type declaration of `BackgroundTasks`:
    
    {* ../../docs_src/background_tasks/tutorial001_py39.py hl[1,13] *}
    
    **FastAPI** will create the object of type `BackgroundTasks` for you and pass it as that parameter.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 4.8K bytes
    - Viewed (0)
  2. docs/pt/docs/tutorial/background-tasks.md

    ## Usando `BackgroundTasks` { #using-backgroundtasks }
    
    Primeiro, importe `BackgroundTasks` e defina um parâmetro na sua *função de operação de rota* com uma declaração de tipo `BackgroundTasks`:
    
    {* ../../docs_src/background_tasks/tutorial001_py39.py hl[1,13] *}
    
    O **FastAPI** criará o objeto do tipo `BackgroundTasks` para você e o passará como esse parâmetro.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  3. docs/es/docs/tutorial/background-tasks.md

    ## Usando `BackgroundTasks` { #using-backgroundtasks }
    
    Primero, importa `BackgroundTasks` y define un parámetro en tu *path operation function* con una declaración de tipo de `BackgroundTasks`:
    
    {* ../../docs_src/background_tasks/tutorial001_py39.py hl[1,13] *}
    
    **FastAPI** creará el objeto de tipo `BackgroundTasks` por ti y lo pasará como ese parámetro.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  4. docs/ru/docs/tutorial/background-tasks.md

    ## Использование `BackgroundTasks` { #using-backgroundtasks }
    
    Сначала импортируйте `BackgroundTasks` и объявите параметр в вашей функции‑обработчике пути с типом `BackgroundTasks`:
    
    {* ../../docs_src/background_tasks/tutorial001_py39.py hl[1,13] *}
    
    **FastAPI** создаст объект типа `BackgroundTasks` для вас и передаст его через этот параметр.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 7.6K bytes
    - Viewed (0)
  5. docs/de/docs/tutorial/background-tasks.md

    ## `BackgroundTasks` verwenden { #using-backgroundtasks }
    
    Importieren Sie zunächst `BackgroundTasks` und definieren Sie einen Parameter in Ihrer *Pfadoperation-Funktion* mit der Typdeklaration `BackgroundTasks`:
    
    {* ../../docs_src/background_tasks/tutorial001_py39.py hl[1,13] *}
    
    **FastAPI** erstellt für Sie das Objekt vom Typ `BackgroundTasks` und übergibt es als diesen Parameter.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 5.8K bytes
    - Viewed (0)
  6. docs/en/docs/reference/background.md

    # Background Tasks - `BackgroundTasks`
    
    You can declare a parameter in a *path operation function* or dependency function with the type `BackgroundTasks`, and then you can use it to schedule the execution of background tasks after the response is sent.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import BackgroundTasks
    ```
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 377 bytes
    - Viewed (0)
  7. fastapi/background.py

    from typing import Annotated, Any, Callable
    
    from annotated_doc import Doc
    from starlette.background import BackgroundTasks as StarletteBackgroundTasks
    from typing_extensions import ParamSpec
    
    P = ParamSpec("P")
    
    
    class BackgroundTasks(StarletteBackgroundTasks):
        """
        A collection of background tasks that will be called after a response has been
        sent to the client.
    
        Read more about it in the
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  8. docs_src/background_tasks/tutorial002_py310.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: str | None = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 643 bytes
    - Viewed (0)
  9. docs/ko/docs/tutorial/background-tasks.md

    * 데이터 처리:
        * 예를 들어 처리에 오랜 시간이 걸리는 데이터를 받았을 때 "Accepted" (HTTP 202)을 반환하고, 백그라운드에서 데이터를 처리할 수 있습니다.
    
    ## `백그라운드 작업` 사용
    
    먼저 아래와 같이 `BackgroundTasks`를 임포트하고, `BackgroundTasks`를 _경로 작동 함수_ 에서 매개변수로 가져오고 정의합니다.
    
    {* ../../docs_src/background_tasks/tutorial001.py hl[1,13] *}
    
    **FastAPI** 는 `BackgroundTasks` 개체를 생성하고, 매개 변수로 전달합니다.
    
    ## 작업 함수 생성
    
    백그라운드 작업으로 실행할 함수를 정의합니다.
    
    이것은 단순히 매개변수를 받을 수 있는 표준 함수일 뿐입니다.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  10. docs_src/background_tasks/tutorial002_an_py310.py

    from typing import Annotated
    
    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: str | None = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 683 bytes
    - Viewed (0)
Back to top