Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 41 - 50 of 980 for tutorial005_py310 (0.11 seconds)

  1. docs/zh-hant/docs/advanced/path-operation-advanced-configuration.md

    {* ../../docs_src/path_operation_advanced_configuration/tutorial001_py310.py hl[6] *}
    
    ### 使用路徑操作函式(path operation function)的名稱作為 operationId { #using-the-path-operation-function-name-as-the-operationid }
    
    如果你想用 API 的函式名稱作為 `operationId`,你可以遍歷所有路徑,並使用各自的 `APIRoute.name` 覆寫每個*路徑操作*的 `operation_id`。
    
    應在加入所有*路徑操作*之後再這麼做。
    
    {* ../../docs_src/path_operation_advanced_configuration/tutorial002_py310.py hl[2, 12:21, 24] *}
    
    /// tip
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 6.5K bytes
    - Click Count (0)
  2. docs/zh/docs/advanced/path-operation-advanced-configuration.md

    {* ../../docs_src/path_operation_advanced_configuration/tutorial001_py310.py hl[6] *}
    
    ### 使用 *路径操作函数* 的函数名作为 operationId { #using-the-path-operation-function-name-as-the-operationid }
    
    如果你想用 API 的函数名作为 `operationId`,你可以遍历所有路径操作,并使用它们的 `APIRoute.name` 重写每个 *路径操作* 的 `operation_id`。
    
    你应该在添加了所有 *路径操作* 之后执行此操作。
    
    {* ../../docs_src/path_operation_advanced_configuration/tutorial002_py310.py hl[2, 12:21, 24] *}
    
    /// tip
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 6.7K bytes
    - Click Count (0)
  3. docs/zh/docs/tutorial/body-nested-models.md

    {* ../../docs_src/body_nested_models/tutorial005_py310.py hl[2,8] *}
    
    该字符串将被检查是否为有效的 URL,并在 JSON Schema / OpenAPI 文档中进行记录。
    
    ## 带有一组子模型的属性 { #attributes-with-lists-of-submodels }
    
    你还可以将 Pydantic 模型用作 `list`、`set` 等的子类型:
    
    {* ../../docs_src/body_nested_models/tutorial006_py310.py hl[18] *}
    
    这将期望(转换,校验,记录文档等)下面这样的 JSON 请求体:
    
    ```JSON hl_lines="11"
    {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 6.8K bytes
    - Click Count (0)
  4. docs/en/docs/advanced/custom-response.md

    {* ../../docs_src/response_directly/tutorial002_py310.py hl[1,18] *}
    
    ### `HTMLResponse` { #htmlresponse }
    
    Takes some text or bytes and returns an HTML response, as you read above.
    
    ### `PlainTextResponse` { #plaintextresponse }
    
    Takes some text or bytes and returns a plain text response.
    
    {* ../../docs_src/custom_response/tutorial005_py310.py hl[2,7,9] *}
    
    ### `JSONResponse` { #jsonresponse }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 11K bytes
    - Click Count (0)
  5. docs/zh-hant/docs/tutorial/extra-models.md

    同樣地,你可以將回應宣告為物件的 `list`。
    
    為此,使用標準的 Python `list`:
    
    {* ../../docs_src/extra_models/tutorial004_py310.py hl[18] *}
    
    ## 以任意 `dict` 作為回應 { #response-with-arbitrary-dict }
    
    你也可以用一般的任意 `dict` 宣告回應,只需指定鍵和值的型別,而不必使用 Pydantic 模型。
    
    當你事先不知道可用的欄位/屬性名稱(定義 Pydantic 模型所需)時,這很實用。
    
    此時可使用 `dict`:
    
    {* ../../docs_src/extra_models/tutorial005_py310.py hl[6] *}
    
    ## 重點回顧 { #recap }
    
    依情境使用多個 Pydantic 模型並靈活繼承。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 6.3K bytes
    - Click Count (0)
  6. docs/en/docs/tutorial/handling-errors.md

    The `RequestValidationError` contains the `body` it received with invalid data.
    
    You could use it while developing your app to log the body and debug it, return it to the user, etc.
    
    {* ../../docs_src/handling_errors/tutorial005_py310.py hl[14] *}
    
    Now try sending an invalid item like:
    
    ```JSON
    {
      "title": "towel",
      "size": "XL"
    }
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 8.9K bytes
    - Click Count (0)
  7. docs/en/docs/python-types.md

    {* ../../docs_src/python_types/tutorial003_py310.py hl[1] *}
    
    Because the editor knows the types of the variables, you don't only get completion, you also get error checks:
    
    <img src="/img/python-types/image04.png">
    
    Now you know that you have to fix it, convert `age` to a string with `str(age)`:
    
    {* ../../docs_src/python_types/tutorial004_py310.py hl[2] *}
    
    ## Declaring types { #declaring-types }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 11K bytes
    - Click Count (0)
  8. docs/zh-hant/docs/python-types.md

    ///
    
    ## 動機 { #motivation }
    
    先從一個簡單的例子開始:
    
    {* ../../docs_src/python_types/tutorial001_py310.py *}
    
    執行這個程式會輸出:
    
    ```
    John Doe
    ```
    
    這個函式會做以下事情:
    
    * 接收 `first_name` 與 `last_name`。
    * 用 `title()` 把每個字的第一個字母轉成大寫。
    * 用一個空白把它們<dfn title="把它們合在一起,成為一個。將其中一個的內容接在另一個後面。">串接</dfn>起來。
    
    {* ../../docs_src/python_types/tutorial001_py310.py hl[2] *}
    
    ### 編輯它 { #edit-it }
    
    這是一個非常簡單的程式。
    
    但現在想像你正從零開始寫它。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 10.7K bytes
    - Click Count (0)
  9. docs/ja/docs/tutorial/handling-errors.md

    `RequestValidationError`には無効なデータを含む`body`が含まれています。
    
    アプリ開発中にボディのログを取ってデバッグしたり、ユーザーに返したりなどに使用することができます。
    
    {* ../../docs_src/handling_errors/tutorial005_py310.py hl[14] *}
    
    ここで、以下のような無効な項目を送信してみてください:
    
    ```JSON
    {
      "title": "towel",
      "size": "XL"
    }
    ```
    
    受信したボディを含むデータが無効であることを示すレスポンスが表示されます:
    
    ```JSON hl_lines="12-15"
    {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 11.2K bytes
    - Click Count (0)
  10. docs/en/docs/tutorial/response-model.md

    We can instead create an input model with the plaintext password and an output model without it:
    
    {* ../../docs_src/response_model/tutorial003_py310.py hl[9,11,16] *}
    
    Here, even though our *path operation function* is returning the same input user that contains the password:
    
    {* ../../docs_src/response_model/tutorial003_py310.py hl[24] *}
    
    ...we declared the `response_model` to be our model `UserOut`, that doesn't include the password:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 15.5K bytes
    - Click Count (0)
Back to Top