- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 22 for BackgroundTasks (0.24 sec)
-
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é. ```Python hl_lines="1 13" {!../../../docs_src/background_tasks/tutorial001.py!} ``` **FastAPI** créera l'objet de type `BackgroundTasks` pour vous et le passera comme paramètre. ## Créer une fonction de tâche
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu May 12 00:06:16 GMT 2022 - 5.7K bytes - Viewed (0) -
docs_src/background_tasks/tutorial002_an.py
from typing import Union from fastapi import BackgroundTasks, Depends, FastAPI from typing_extensions import Annotated 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: Union[str, None] = None): if q: message = f"found query: {q}\n" background_tasks.add_task(write_log, message) return q
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 725 bytes - Viewed (0) -
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 ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 377 bytes - Viewed (0) -
docs/ja/docs/tutorial/background-tasks.md
* データ処理: * たとえば、時間のかかる処理を必要とするファイル受信時には、「受信済み」(HTTP 202) のレスポンスを返し、バックグラウンドで処理できます。 ## `BackgroundTasks` の使用 まず初めに、`BackgroundTasks` をインポートし、` BackgroundTasks` の型宣言と共に、*path operation 関数* のパラメーターを定義します: ```Python hl_lines="1 13" {!../../../docs_src/background_tasks/tutorial001.py!} ``` **FastAPI** は、`BackgroundTasks` 型のオブジェクトを作成し、そのパラメーターに渡します。 ## タスク関数の作成 バックグラウンドタスクとして実行される関数を作成します。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Jan 15 16:12:39 GMT 2024 - 6.1K bytes - Viewed (0) -
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
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 683 bytes - Viewed (1) -
docs/ru/docs/tutorial/background-tasks.md
## Использование класса `BackgroundTasks` Сначала импортируйте `BackgroundTasks`, потом добавьте в функцию параметр с типом `BackgroundTasks`: ```Python hl_lines="1 13" {!../../../docs_src/background_tasks/tutorial001.py!} ``` **FastAPI** создаст объект класса `BackgroundTasks` для вас и запишет его в параметр. ## Создание функции для фоновой задачи
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Jan 09 15:52:07 GMT 2024 - 8K bytes - Viewed (0) -
docs/ko/docs/tutorial/background-tasks.md
* 예를 들어 처리에 오랜 시간이 걸리는 데이터를 받았을 때 "Accepted" (HTTP 202)을 반환하고, 백그라운드에서 데이터를 처리할 수 있습니다. ## `백그라운드 작업` 사용 먼저 아래와 같이 `BackgroundTasks`를 임포트하고, `BackgroundTasks`를 _경로 작동 함수_ 에서 매개변수로 가져오고 정의합니다. ```Python hl_lines="1 13" {!../../../docs_src/background_tasks/tutorial001.py!} ``` **FastAPI** 는 `BackgroundTasks` 개체를 생성하고, 매개 변수로 전달합니다. ## 작업 함수 생성 백그라운드 작업으로 실행할 함수를 정의합니다. 이것은 단순히 매개변수를 받을 수 있는 표준 함수일 뿐입니다.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sun Feb 11 13:48:31 GMT 2024 - 5.7K bytes - Viewed (0) -
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` 类型的对象并作为该参数传入。 ## 创建一个任务函数 创建要作为后台任务运行的函数。 它只是一个可以接收参数的标准函数。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 5K bytes - Viewed (0) -
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`: ```Python hl_lines="1 13" {!../../../docs_src/background_tasks/tutorial001.py!} ``` **FastAPI** will create the object of type `BackgroundTasks` for you and pass it as that parameter. ## Create a task function
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 5.6K bytes - Viewed (0) -
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` 👆 & 🚶♀️ ⚫️ 👈 🔢. ## ✍ 📋 🔢 ✍ 🔢 🏃 🖥 📋. ⚫️ 🐩 🔢 👈 💪 📨 🔢.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Apr 01 09:26:04 GMT 2023 - 4.1K bytes - Viewed (0)