- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 78 for tutorial003 (0.04 sec)
-
tests/test_tutorial/test_body_nested_models/test_tutorial001_tutorial002_tutorial003.py
tags_schema = {"default": [], "title": "Tags"} if mod_name.startswith("tutorial001"): tags_schema.update(UNTYPED_LIST_SCHEMA) elif mod_name.startswith("tutorial002"): tags_schema.update(LIST_OF_STR_SCHEMA) elif mod_name.startswith("tutorial003"): tags_schema.update(SET_OF_STR_SCHEMA) response = client.get("/openapi.json")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 7.9K bytes - Viewed (0) -
docs/ko/docs/tutorial/security/simple-oauth2.md
이제 **FastAPI**에서 제공하는 유틸리티를 사용하여 이를 처리해 보겠습니다. ### `OAuth2PasswordRequestForm` 먼저 `OAuth2PasswordRequestForm`을 가져와 `/token`에 대한 *경로 작동*에서 `Depends`의 의존성으로 사용합니다. {* ../../docs_src/security/tutorial003.py hl[4,76] *} `OAuth2PasswordRequestForm`은 다음을 사용하여 폼 본문을 선언하는 클래스 의존성입니다: * `username`. * `password`. * `scope`는 선택적인 필드로 공백으로 구분된 문자열로 구성된 큰 문자열입니다. * `grant_type`(선택적으로 사용). /// tip | 팁Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Feb 15 11:19:12 UTC 2025 - 10.8K bytes - Viewed (0) -
docs/zh/docs/advanced/events.md
首先要注意的是,我们定义了一个带有 `yield` 的异步函数。这与带有 `yield` 的依赖项非常相似。 ```Python hl_lines="14-19" {!../../docs_src/events/tutorial003.py!} ``` 这个函数在 `yield`之前的部分,会在应用启动前执行。 剩下的部分在 `yield` 之后,会在应用完成后执行。 ## 异步上下文管理器 如你所见,这个函数有一个装饰器 `@asynccontextmanager` 。 它将函数转化为所谓的“**异步上下文管理器**”。 ```Python hl_lines="1 13" {!../../docs_src/events/tutorial003.py!} ``` 在 Python 中, **上下文管理器**是一个你可以在 `with` 语句中使用的东西,例如,`open()` 可以作为上下文管理器使用。Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 7K bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py
import pytest from dirty_equals import IsList from fastapi.testclient import TestClient from ...utils import needs_py310 DESCRIPTIONS = { "tutorial003": "Create an item with all the information, name, description, price, tax and a set of unique tags", "tutorial004": dedent(""" Create an item with all the information: - **name**: each item must have a name - **description**: a long descriptionRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 7K bytes - Viewed (0) -
docs/uk/docs/tutorial/metadata.md
* Ви можете вимкнути його, встановивши `redoc_url=None`. Наприклад, щоб налаштувати Swagger UI на `/documentation` і вимкнути ReDoc:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Mar 19 17:09:57 UTC 2025 - 8.4K bytes - Viewed (0) -
docs/ko/docs/advanced/events.md
{* ../../docs_src/events/tutorial003.py hl[14:19] *} 함수의 첫 번째 부분, 즉 `yield` 이전의 코드는 애플리케이션이 시작되기 **전에** 실행됩니다. 그리고 `yield` 이후의 부분은 애플리케이션이 완료된 후 **나중에** 실행됩니다. ### 비동기 컨텍스트 매니저 함수를 확인해보면, `@asynccontextmanager`로 장식되어 있습니다. 이것은 함수를 "**비동기 컨텍스트 매니저**"라고 불리는 것으로 변환시킵니다. {* ../../docs_src/events/tutorial003.py hl[1,13] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 9.2K bytes - Viewed (0) -
docs/zh/docs/advanced/dataclasses.md
本例把标准的 `dataclasses` 直接替换为 `pydantic.dataclasses`: ```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" } {!../../docs_src/dataclasses_/tutorial003.py!} ``` 1. 本例依然要从标准的 `dataclasses` 中导入 `field`; 2. 使用 `pydantic.dataclasses` 直接替换 `dataclasses`; 3. `Author` 数据类包含 `Item` 数据类列表; 4. `Author` 数据类用于 `response_model` 参数; 5. 其它带有数据类的标准类型注解也可以作为请求体; 本例使用的是 `Item` 数据类列表;Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 3.7K bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial002_tutorial003_tutorial004.py
assert response.status_code == 200, response.text assert response.text == html_contents def test_openapi_schema(client: TestClient, mod_name: str): if mod_name.startswith("tutorial003"): response_content = {"application/json": {"schema": {}}} else: response_content = {"text/html": {"schema": {"type": "string"}}} response = client.get("/openapi.json")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.8K bytes - Viewed (0) -
docs/ko/docs/advanced/custom-response.md
{* ../../docs_src/response_directly/tutorial002.py hl[1,18] *} ### `HTMLResponse` 텍스트 또는 바이트를 받아 HTML 응답을 반환합니다. 위에서 설명한 내용과 같습니다. ### `PlainTextResponse` 텍스트 또는 바이트를 받아 일반 텍스트 응답을 반환합니다. {* ../../docs_src/custom_response/tutorial005.py hl[2,7,9] *} ### `JSONResponse` 데이터를 받아 `application/json`으로 인코딩된 응답을 반환합니다.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Feb 15 11:21:20 UTC 2025 - 13.4K bytes - Viewed (0) -
docs/zh/docs/tutorial/handling-errors.md
一般情况下可能不会需要在代码中直接使用响应头。 但对于某些高级应用场景,还是需要添加自定义响应头: {* ../../docs_src/handling_errors/tutorial002.py hl[14] *} ## 安装自定义异常处理器 添加自定义处理器,要使用 [Starlette 的异常工具](https://www.starlette.dev/exceptions/)。 假设要触发的自定义异常叫作 `UnicornException`。 且需要 FastAPI 实现全局处理该异常。 此时,可以用 `@app.exception_handler()` 添加自定义异常控制器: {* ../../docs_src/handling_errors/tutorial003.py hl[5:7,13:18,24] *} 请求 `/unicorns/yolo` 时,路径操作会触发 `UnicornException`。Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 8.2K bytes - Viewed (0)