Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for BackgroundTasks (0.11 sec)

  1. 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 Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 377 bytes
    - Viewed (0)
  2. docs/de/docs/tutorial/background-tasks.md

    ## `BackgroundTasks` verwenden
    
    Importieren Sie zunächst `BackgroundTasks` und definieren Sie einen Parameter in Ihrer *Pfadoperation-Funktion* mit der Typdeklaration `BackgroundTasks`:
    
    ```Python hl_lines="1  13"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    **FastAPI** erstellt für Sie das Objekt vom Typ `BackgroundTasks` und übergibt es als diesen Parameter.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  3. 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 Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 683 bytes
    - Viewed (0)
  4. docs/pt/docs/tutorial/background-tasks.md

    ## Usando `BackgroundTasks`
    
    Primeiro, importe `BackgroundTasks` e defina um parâmetro em sua _função de operação de caminho_ com uma declaração de tipo de `BackgroundTasks`:
    
    ```Python hl_lines="1  13"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    O **FastAPI** criará o objeto do tipo `BackgroundTasks` para você e o passará como esse parâmetro.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.3K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/background-tasks.md

    ## 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.py hl[1,13] *}
    
    **FastAPI** will create the object of type `BackgroundTasks` for you and pass it as that parameter.
    
    ## Create a task function
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 15:22:48 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  6. fastapi/background.py

    from typing import Any, Callable
    
    from starlette.background import BackgroundTasks as StarletteBackgroundTasks
    from typing_extensions import Annotated, Doc, 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 Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Apr 02 02:48:51 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/background-tasks.md

    ## Использование класса `BackgroundTasks`
    
    Сначала импортируйте `BackgroundTasks`, потом добавьте в функцию параметр с типом `BackgroundTasks`:
    
    ```Python hl_lines="1  13"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    **FastAPI** создаст объект класса `BackgroundTasks` для вас и запишет его в параметр.
    
    ## Создание функции для фоновой задачи
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8K bytes
    - Viewed (0)
  8. docs/fr/docs/tutorial/background-tasks.md

    
    ## Utiliser `BackgroundTasks`
    
    Pour commencer, importez `BackgroundTasks` et définissez un paramètre dans votre *fonction de chemin* avec `BackgroundTasks` comme type déclaré.
    
    {* ../../docs_src/background_tasks/tutorial001.py hl[1,13] *}
    
    **FastAPI** créera l'objet de type `BackgroundTasks` pour vous et le passera comme paramètre.
    
    ## Créer une fonction de tâche
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 28 10:29:51 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  9. docs/em/docs/tutorial/background-tasks.md

        * 🖼, ➡️ 💬 👆 📨 📁 👈 🔜 🚶 🔘 🐌 🛠️, 👆 💪 📨 📨 "🚫" (🇺🇸🔍 2️⃣0️⃣2️⃣) & 🛠️ ⚫️ 🖥.
    
    ## ⚙️ `BackgroundTasks`
    
    🥇, 🗄 `BackgroundTasks` & 🔬 🔢 👆 *➡ 🛠️ 🔢* ⏮️ 🆎 📄 `BackgroundTasks`:
    
    ```Python hl_lines="1  13"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    **FastAPI** 🔜 ✍ 🎚 🆎 `BackgroundTasks` 👆 & 🚶‍♀️ ⚫️ 👈 🔢.
    
    ## ✍ 📋 🔢
    
    ✍ 🔢 🏃 🖥 📋.
    
    ⚫️ 🐩 🔢 👈 💪 📨 🔢.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/background-tasks.md

    * 处理数据:
        * 例如,假设您收到的文件必须经过一个缓慢的过程,您可以返回一个"Accepted"(HTTP 202)响应并在后台处理它。
    
    ## 使用 `BackgroundTasks`
    
    首先导入 `BackgroundTasks` 并在 *路径操作函数* 中使用类型声明 `BackgroundTasks` 定义一个参数:
    
    ```Python hl_lines="1  13"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    **FastAPI** 会创建一个 `BackgroundTasks` 类型的对象并作为该参数传入。
    
    ## 创建一个任务函数
    
    创建要作为后台任务运行的函数。
    
    它只是一个可以接收参数的标准函数。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5K bytes
    - Viewed (0)
Back to top