Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 951 - 960 of 2,110 for py$ (0.08 seconds)

  1. docs/zh/docs/tutorial/body-nested-models.md

    对具有内部类型的模型属性也使用相同的标准语法。
    
    因此,在我们的示例中,我们可以将 `tags` 明确地指定为一个「字符串列表」:
    
    {* ../../docs_src/body_nested_models/tutorial002_py310.py hl[12] *}
    
    ## Set 类型 { #set-types }
    
    但是随后我们考虑了一下,意识到标签不应该重复,它们很大可能会是唯一的字符串。
    
    而 Python 有一种用于保存唯一元素集合的特殊数据类型 `set`。
    
    然后我们可以将 `tags` 声明为一个由字符串组成的 set:
    
    {* ../../docs_src/body_nested_models/tutorial003_py310.py hl[12] *}
    
    这样,即使你收到带有重复数据的请求,这些数据也会被转换为一组唯一项。
    
    而且,每当你输出该数据时,即使源数据有重复,它们也将作为一组唯一项输出。
    
    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)
  2. docs/ja/docs/tutorial/stream-json-lines.md

    FastAPI で JSON Lines をストリームするには、*path operation 関数*で `return` を使う代わりに、`yield` を使って各アイテムを順に生成します。
    
    {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[24] *}
    
    送り返す各 JSON アイテムが `Item`(Pydantic モデル)型で、関数が async の場合、戻り値の型を `AsyncIterable[Item]` と宣言できます:
    
    {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[9:11,22] *}
    
    戻り値の型を宣言すると、FastAPI はそれを使ってデータを**検証**し、OpenAPI に**ドキュメント化**し、**フィルター**し、Pydantic で**シリアライズ**します。
    
    /// tip | 豆知識
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:55:22 GMT 2026
    - 5.1K bytes
    - Click Count (0)
  3. docs/en/docs/advanced/testing-events.md

    {* ../../docs_src/app_testing/tutorial004_py310.py hl[9:15,18,27:28,30:32,41:43] *}
    
    
    You can read more details about the ["Running lifespan in tests in the official Starlette documentation site."](https://www.starlette.dev/lifespan/#running-lifespan-in-tests)
    
    For the deprecated `startup` and `shutdown` events, you can use the `TestClient` as follows:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 628 bytes
    - Click Count (0)
  4. docs/zh-hant/docs/advanced/websockets.md

    當然,這並不理想,你不會在生產環境這樣做。
    
    在生產環境你通常會用上述其中一種方式。
    
    但這是能讓我們專注於 WebSocket 伺服端並跑起一個可運作範例的最簡單方式:
    
    {* ../../docs_src/websockets_/tutorial001_py310.py hl[2,6:38,41:43] *}
    
    ## 建立一個 `websocket` { #create-a-websocket }
    
    在你的 **FastAPI** 應用中,建立一個 `websocket`:
    
    {* ../../docs_src/websockets_/tutorial001_py310.py hl[1,46:47] *}
    
    /// note | 技術細節
    
    你也可以使用 `from starlette.websockets import WebSocket`。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 5.2K bytes
    - Click Count (0)
  5. docs/ja/docs/tutorial/server-sent-events.md

    `EventSourceResponse` は `fastapi.sse` からインポートします:
    
    {* ../../docs_src/server_sent_events/tutorial001_py310.py ln[1:25] hl[4,22] *}
    
    yield された各アイテムは JSON にエンコードされ、SSE イベントの `data:` フィールドで送信されます。
    
    戻り値の型を `AsyncIterable[Item]` と宣言すると、FastAPI は Pydantic を用いてデータを**検証**、**ドキュメント化**、**シリアライズ**します。
    
    {* ../../docs_src/server_sent_events/tutorial001_py310.py ln[1:25] hl[10:12,23] *}
    
    /// tip | 豆知識
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:55:22 GMT 2026
    - 5.8K bytes
    - Click Count (0)
  6. docs/zh/docs/tutorial/body.md

    ///
    
    ## 导入 Pydantic 的 `BaseModel` { #import-pydantics-basemodel }
    
    从 `pydantic` 中导入 `BaseModel`:
    
    {* ../../docs_src/body/tutorial001_py310.py hl[2] *}
    
    ## 创建数据模型 { #create-your-data-model }
    
    把数据模型声明为继承 `BaseModel` 的类。
    
    使用 Python 标准类型声明所有属性:
    
    {* ../../docs_src/body/tutorial001_py310.py hl[5:9] *}
    
    与声明查询参数一样,包含默认值的模型属性是可选的,否则就是必选的。把默认值设为 `None` 可使其变为可选。
    
    例如,上述模型声明如下 JSON "object"(即 Python `dict`):
    
    ```JSON
    {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 5.9K bytes
    - Click Count (0)
  7. docs/zh/docs/tutorial/first-steps.md

    # 第一步 { #first-steps }
    
    最简单的 FastAPI 文件可能像下面这样:
    
    {* ../../docs_src/first_steps/tutorial001_py310.py *}
    
    将其复制到 `main.py` 文件中。
    
    运行实时服务器:
    
    <div class="termy">
    
    ```console
    $ <font color="#4E9A06">fastapi</font> dev
    
      <span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span>  Starting development server 🚀
    
                 Searching for package file structure from directories
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 13.3K bytes
    - Click Count (0)
  8. docs/ko/docs/tutorial/first-steps.md

    # 첫걸음 { #first-steps }
    
    가장 단순한 FastAPI 파일은 다음과 같이 보일 것입니다:
    
    {* ../../docs_src/first_steps/tutorial001_py310.py *}
    
    위 코드를 `main.py`에 복사합니다.
    
    라이브 서버를 실행합니다:
    
    <div class="termy">
    
    ```console
    $ <font color="#4E9A06">fastapi</font> dev
    
      <span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span>  Starting development server 🚀
    
                 Searching for package file structure from directories
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 15K bytes
    - Click Count (0)
  9. docs/en/docs/advanced/response-headers.md

    You can declare a parameter of type `Response` in your *path operation function* (as you can do for cookies).
    
    And then you can set headers in that *temporal* response object.
    
    {* ../../docs_src/response_headers/tutorial002_py310.py hl[1, 7:8] *}
    
    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.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 2.2K bytes
    - Click Count (0)
  10. docs/en/docs/advanced/vibe.md

    You don't even need to write the body of the function. The `@app.vibe()` decorator does everything for you based on AI vibes:
    
    {* ../../docs_src/vibe/tutorial001_py310.py hl[8:12] *}
    
    ## Benefits { #benefits }
    
    By using `@app.vibe()`, you get to enjoy:
    
    * **Freedom**: No data validation. No schemas. No constraints. Just vibes. ✨
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Apr 01 16:16:24 GMT 2026
    - 2K bytes
    - Click Count (0)
Back to Top