- Sort Score
- Result 10 results
- Languages All
Results 161 - 170 of 877 for tutorial002 (0.06 sec)
-
docs/en/docs/advanced/response-headers.md
And then you can set headers in that *temporal* response object. ```Python hl_lines="1 7-8" {!../../docs_src/response_headers/tutorial002.py!} ``` And then you can return any object you need, as you normally would (a `dict`, a database model, etc). And if you declared a `response_model`, it will still be used to filter and convert the object you returned.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 2.2K bytes - Viewed (0) -
docs/zh/docs/advanced/events.md
使用 `startup` 事件声明 `app` 启动前运行的函数: ```Python hl_lines="8" {!../../docs_src/events/tutorial001.py!} ``` 本例中,`startup` 事件处理器函数为项目数据库(只是**字典**)提供了一些初始值。 **FastAPI** 支持多个事件处理器函数。 只有所有 `startup` 事件处理器运行完毕,**FastAPI** 应用才开始接收请求。 ## `shutdown` 事件 使用 `shutdown` 事件声明 `app` 关闭时运行的函数: ```Python hl_lines="6" {!../../docs_src/events/tutorial002.py!} ``` 此处,`shutdown` 事件处理器函数在 `log.txt` 中写入一行文本 `Application shutdown`。
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 1.7K bytes - Viewed (0) -
docs/pt/docs/tutorial/path-params-numeric-validations.md
```Python hl_lines="8" {!../../docs_src/path_params_numeric_validations/tutorial004.py!} ``` ## Validações numéricas: maior que e menor que ou igual O mesmo se aplica para: * `gt`: maior que (`g`reater `t`han) * `le`: menor que ou igual (`l`ess than or `e`qual) ```Python hl_lines="9" {!../../docs_src/path_params_numeric_validations/tutorial005.py!} ```
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.6K bytes - Viewed (0) -
docs/fr/docs/tutorial/query-params.md
## Paramètres optionnels De la même façon, vous pouvez définir des paramètres de requête comme optionnels, en leur donnant comme valeur par défaut `None` : {* ../../docs_src/query_params/tutorial002.py hl[9] *} Ici, le paramètre `q` sera optionnel, et aura `None` comme valeur par défaut. /// check | "Remarque"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 17:06:01 UTC 2024 - 5.6K bytes - Viewed (0) -
tests/test_tutorial/test_additional_responses/test_tutorial002.py
import os import shutil from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.additional_responses.tutorial002 import app client = TestClient(app) def test_path_operation(): response = client.get("/items/foo") assert response.status_code == 200, response.text assert response.json() == {"id": "foo", "value": "there goes my hero"} def test_path_operation_img():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.6K bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py
import pytest from fastapi.testclient import TestClient from ...utils import needs_pydanticv2 @pytest.fixture(name="client") def get_client() -> TestClient: from docs_src.separate_openapi_schemas.tutorial002 import app client = TestClient(app) return client def test_create_item(client: TestClient) -> None: response = client.post("/items/", json={"name": "Foo"}) assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 25 19:10:22 UTC 2023 - 4.8K bytes - Viewed (0) -
docs/de/docs/advanced/middleware.md
```Python hl_lines="2 6" {!../../docs_src/advanced_middleware/tutorial001.py!} ``` ## `TrustedHostMiddleware` Erzwingt, dass alle eingehenden Requests einen korrekt gesetzten `Host`-Header haben, um sich vor HTTP-Host-Header-Angriffen zu schützen. ```Python hl_lines="2 6-8" {!../../docs_src/advanced_middleware/tutorial002.py!} ``` Die folgenden Argumente werden unterstützt:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 4.3K bytes - Viewed (0) -
docs/em/docs/advanced/dataclasses.md
✋️ 🚥 👆 ✔️ 📚 🎻 🤥 🤭, 👉 👌 🎱 ⚙️ 👫 🏋️ 🕸 🛠️ ⚙️ FastAPI. 👶 /// ## 🎻 `response_model` 👆 💪 ⚙️ `dataclasses` `response_model` 🔢: ```Python hl_lines="1 7-13 19" {!../../docs_src/dataclasses/tutorial002.py!} ``` 🎻 🔜 🔁 🗜 Pydantic 🎻. 👉 🌌, 🚮 🔗 🔜 🎦 🆙 🛠️ 🩺 👩💻 🔢: <img src="/img/tutorial/dataclasses/image01.png"> ## 🎻 🔁 📊 📊 👆 💪 🌀 `dataclasses` ⏮️ 🎏 🆎 ✍ ⚒ 🐦 📊 📊.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 3.4K bytes - Viewed (0) -
docs/pt/docs/tutorial/schema-extra-example.md
Você pode usar isso para adicionar um `example` para cada campo: ```Python hl_lines="4 10-13" {!../../docs_src/schema_extra_example/tutorial002.py!} ``` /// warning | "Atenção" Lembre-se de que esses argumentos extras passados não adicionarão nenhuma validação, apenas informações extras, para fins de documentação. ///
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.1K bytes - Viewed (0) -
docs/zh/docs/advanced/response-headers.md
# 响应头 ## 使用 `Response` 参数 你可以在你的*路径操作函数*中声明一个`Response`类型的参数(就像你可以为cookies做的那样)。 然后你可以在这个*临时*响应对象中设置头部。 ```Python hl_lines="1 7-8" {!../../docs_src/response_headers/tutorial002.py!} ``` 然后你可以像平常一样返回任何你需要的对象(例如一个`dict`或者一个数据库模型)。如果你声明了一个`response_model`,它仍然会被用来过滤和转换你返回的对象。 **FastAPI**将使用这个临时响应来提取头部(也包括cookies和状态码),并将它们放入包含你返回的值的最终响应中,该响应由任何`response_model`过滤。 你也可以在依赖项中声明`Response`参数,并在其中设置头部(和cookies)。 ## 直接返回 `Response`
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 2K bytes - Viewed (0)