Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1111 - 1120 of 2,110 for py$ (0.01 seconds)

  1. docs/zh-hant/docs/advanced/generate-clients.md

    其中有些方案也可能是開源或提供免費方案,讓你不需財務承諾就能試用。其他商業的 SDK 產生器也不少,你可以在網路上找到。🤓
    
    ## 建立 TypeScript SDK { #create-a-typescript-sdk }
    
    先從一個簡單的 FastAPI 應用開始:
    
    {* ../../docs_src/generate_clients/tutorial001_py310.py hl[7:9,12:13,16:17,21] *}
    
    注意這些 *路徑操作* 為請求與回應的有效載荷定義了所用的模型,使用了 `Item` 與 `ResponseMessage` 這兩個模型。
    
    ### API 文件 { #api-docs }
    
    如果你前往 `/docs`,你會看到其中包含了請求要送出的資料與回應接收的資料之**結構(schemas)**:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 9.1K bytes
    - Click Count (0)
  2. docs/en/docs/advanced/testing-websockets.md

    You can use the same `TestClient` to test WebSockets.
    
    For this, you use the `TestClient` in a `with` statement, connecting to the WebSocket:
    
    {* ../../docs_src/app_testing/tutorial002_py310.py hl[27:31] *}
    
    /// note
    
    For more details, check Starlette's documentation for [testing WebSockets](https://www.starlette.dev/testclient/#testing-websocket-sessions).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 411 bytes
    - Click Count (0)
  3. docs/zh-hant/docs/how-to/authentication-error-status-code.md

    但如果你的用戶端因某些原因依賴於舊行為,你可以在你的 security 類別中覆寫 `make_not_authenticated_error` 方法以恢復舊的行為。
    
    例如,你可以建立 `HTTPBearer` 的子類別,讓它回傳 `403 Forbidden` 錯誤,而不是預設的 `401 Unauthorized` 錯誤:
    
    {* ../../docs_src/authentication_error_status_code/tutorial001_an_py310.py hl[9:13] *}
    
    /// tip
    注意這個函式回傳的是例外物件本身,而不是直接拋出它。拋出的動作會在其餘的內部程式碼中處理。
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  4. docs/zh-hant/docs/fastapi-cli.md

    如果你的程式碼結構是這樣:
    
    ```
    .
    ├── backend
    │   ├── main.py
    │   ├── __init__.py
    ```
    
    那麼你應該把 `entrypoint` 設為:
    
    ```toml
    [tool.fastapi]
    entrypoint = "backend.main:app"
    ```
    
    這等同於:
    
    ```python
    from backend.main import app
    ```
    
    ### 帶路徑的 `fastapi dev` { #fastapi-dev-with-path }
    
    你也可以把檔案路徑傳給 `fastapi dev` 指令,它會推測要使用的 FastAPI app 物件:
    
    ```console
    $ fastapi dev main.py
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 5.8K bytes
    - Click Count (0)
  5. docs/ja/docs/tutorial/body-fields.md

    まず、以下のようにインポートします:
    
    {* ../../docs_src/body_fields/tutorial001_an_py310.py hl[4] *}
    
    
    /// warning | 注意
    
    `Field`は他の全てのもの(`Query`、`Path`、`Body`など)とは違い、`fastapi`からではなく、`pydantic`から直接インポートされていることに注意してください。
    
    ///
    
    ## モデルの属性の宣言 { #declare-model-attributes }
    
    以下のように`Field`をモデルの属性として使用することができます:
    
    {* ../../docs_src/body_fields/tutorial001_an_py310.py hl[11:14] *}
    
    `Field`は`Query`や`Path`、`Body`と同じように動作し、全く同様のパラメータなどを持ちます。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 16:44:21 GMT 2026
    - 3K bytes
    - Click Count (0)
  6. docs/zh/docs/advanced/testing-websockets.md

    # 测试 WebSockets { #testing-websockets }
    
    你可以使用同一个 `TestClient` 来测试 WebSockets。
    
    为此,在 `with` 语句中使用 `TestClient` 连接到 WebSocket:
    
    {* ../../docs_src/app_testing/tutorial002_py310.py hl[27:31] *}
    
    /// note | 注意
    
    更多细节请查看 Starlette 的文档:[测试 WebSockets](https://www.starlette.dev/testclient/#testing-websocket-sessions)。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 403 bytes
    - Click Count (0)
  7. docs/zh-hant/docs/advanced/settings.md

    你也可以把這些設定放在另一個模組檔案中,就像在[更大的應用程式 - 多個檔案](../tutorial/bigger-applications.md)所示。
    
    例如,你可以有一個 `config.py` 檔案如下:
    
    {* ../../docs_src/settings/app01_py310/config.py *}
    
    然後在 `main.py` 檔案中使用它:
    
    {* ../../docs_src/settings/app01_py310/main.py hl[3,11:13] *}
    
    /// tip
    
    你也需要一個 `__init__.py` 檔案,詳見[更大的應用程式 - 多個檔案](../tutorial/bigger-applications.md)。
    
    ///
    
    ## 在相依中的設定 { #settings-in-a-dependency }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 10.3K bytes
    - Click Count (0)
  8. docs/zh/docs/tutorial/request-forms.md

    ```
    
    ///
    
    ## 导入 `Form` { #import-form }
    
    从 `fastapi` 导入 `Form`:
    
    {* ../../docs_src/request_forms/tutorial001_an_py310.py hl[3] *}
    
    ## 定义 `Form` 参数 { #define-form-parameters }
    
    创建表单参数的方式与 `Body` 或 `Query` 相同:
    
    {* ../../docs_src/request_forms/tutorial001_an_py310.py hl[9] *}
    
    例如,在 OAuth2 规范的一种使用方式(称为“密码流”)中,要求将 `username` 和 `password` 作为表单字段发送。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 2.5K bytes
    - Click Count (0)
  9. docs/en/docs/advanced/async-tests.md

    ```
    .
    ├── app
    │   ├── __init__.py
    │   ├── main.py
    │   └── test_main.py
    ```
    
    The file `main.py` would have:
    
    {* ../../docs_src/async_tests/app_a_py310/main.py *}
    
    The file `test_main.py` would have the tests for `main.py`, it could look like this now:
    
    {* ../../docs_src/async_tests/app_a_py310/test_main.py *}
    
    ## Run it { #run-it }
    
    You can run your tests as usual via:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 3.8K bytes
    - Click Count (0)
  10. docs/en/docs/tutorial/middleware.md

        * Then it returns the `response` generated by the corresponding *path operation*.
    * You can then further modify the `response` before returning it.
    
    {* ../../docs_src/middleware/tutorial001_py310.py hl[8:9,11,14] *}
    
    /// tip
    
    Keep in mind that custom proprietary headers can be added [using the `X-` prefix](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 3.9K bytes
    - Click Count (0)
Back to Top