- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 63 for tutorial004 (0.06 sec)
-
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) -
docs/uk/docs/tutorial/handling-errors.md
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 13.9K 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/zh/docs/python-types.md
## 更多动机 下面是一个已经有类型提示的函数: {* ../../docs_src/python_types/tutorial003.py hl[1] *} 因为编辑器已经知道了这些变量的类型,所以不仅能对代码进行补全,还能检查其中的错误: <img src="https://fastapi.tiangolo.com/img/python-types/image04.png"> 现在你知道了必须先修复这个问题,通过 `str(age)` 把 `age` 转换成字符串: {* ../../docs_src/python_types/tutorial004.py hl[2] *} ## 声明类型 你刚刚看到的就是声明类型提示的主要场景。用于函数的参数。Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Aug 18 06:34:40 UTC 2025 - 8.6K bytes - Viewed (0) -
docs/tr/docs/tutorial/path-params.md
{* ../../docs_src/path_params/tutorial005.py hl[17] *} #### *Enumeration Değerini* Edinelim `model_name.value` veya genel olarak `your_enum_member.value` tanımlarını kullanarak (bu durumda bir `str` olan) gerçek değere ulaşabilirsiniz: {* ../../docs_src/path_params/tutorial005.py hl[20] *} /// tip | İpucuRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Aug 31 10:29:01 UTC 2025 - 10.5K bytes - Viewed (0) -
docs/uk/docs/tutorial/path-params.md
{* ../../docs_src/path_params/tutorial005.py hl[17] *} #### Отримання *значення перелічування* Ви можете отримати фактичне значення (у цьому випадку це `str`), використовуючи `model_name.value`, або загалом `your_enum_member.value`: {* ../../docs_src/path_params/tutorial005.py hl[20] *} /// tip | ПорадаRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Aug 31 10:29:01 UTC 2025 - 14.1K bytes - Viewed (0) -
docs/ja/docs/tutorial/handling-errors.md
また、そのためのデフォルトの例外ハンドラも含まれています。 これをオーバーライドするには`RequestValidationError`をインポートして`@app.exception_handler(RequestValidationError)`と一緒に使用して例外ハンドラをデコレートします。 この例外ハンドラは`Requset`と例外を受け取ります。 {* ../../docs_src/handling_errors/tutorial004.py hl[2,14,15,16] *} これで、`/items/foo`にアクセスすると、デフォルトのJSONエラーの代わりに以下が返されます: ```JSON { "detail": [ { "loc": [ "path", "item_id"
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 11.6K bytes - Viewed (0) -
docs/ja/docs/tutorial/security/oauth2-jwt.md
レスポンスのトークンエンドポイントで使用するPydanticモデルを定義します。 新しいアクセストークンを生成するユーティリティ関数を作成します。 {* ../../docs_src/security/tutorial004.py hl[6,12:14,28:30,78:86] *} ## 依存関係の更新 `get_current_user`を更新して、先ほどと同じトークンを受け取るようにしますが、今回はJWTトークンを使用します。 受け取ったトークンを復号して検証し、現在のユーザーを返します。 トークンが無効な場合は、すぐにHTTPエラーを返します。 {* ../../docs_src/security/tutorial004.py hl[89:106] *} ## `/token` パスオペレーションの更新 トークンの有効期限を表す`timedelta`を作成します。Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Aug 31 10:49:48 UTC 2025 - 14K bytes - Viewed (1) -
docs/en/docs/advanced/generate-clients.md
{* ../../docs_src/generate_clients/tutorial004_py39.py *} //// tab | Node.js ```Javascript {!> ../../docs_src/generate_clients/tutorial004.js!} ``` //// With that, the operation IDs would be renamed from things like `items-get_items` to just `get_items`, that way the client generator can generate simpler method names.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 10.1K bytes - Viewed (1) -
docs/ru/docs/advanced/generate-clients.md
{* ../../docs_src/generate_clients/tutorial004_py39.py *} //// tab | Node.js ```Javascript {!> ../../docs_src/generate_clients/tutorial004.js!} ``` //// После этого ID операций будут переименованы с чего‑то вроде `items-get_items` просто в `get_items`, и генератор клиента сможет создавать более простые имена методов.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 15.9K bytes - Viewed (0)