Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 161 - 170 of 2,086 for FastAPI (0.19 seconds)

  1. docs/zh-hant/docs/alternatives.md

    /// check | 啟發 **FastAPI**
    
    成為一個微框架,讓所需的工具與元件能輕鬆搭配組合。
    
    具備簡單、易用的路由系統。
    
    ///
    
    ### [Requests](https://requests.readthedocs.io) { #requests }
    
    **FastAPI** 其實不是 **Requests** 的替代品。兩者的範疇截然不同。
    
    在 FastAPI 應用程式「內部」使用 Requests 其實很常見。
    
    儘管如此,FastAPI 仍從 Requests 得到了不少啟發。
    
    **Requests** 是一個「與 API 互動」(作為用戶端)的程式庫,而 **FastAPI** 是一個「建立 API」(作為伺服端)的程式庫。
    
    它們大致位於相反兩端,彼此互補。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 20K bytes
    - Click Count (0)
  2. docs/zh-hant/docs/tutorial/server-sent-events.md

    /// tip
    
    如果你要串流二進位資料,例如影片或音訊,請參考進階指南:[串流資料](../advanced/stream-data.md)。
    
    ///
    
    ## 使用 FastAPI 串流 SSE { #stream-sse-with-fastapi }
    
    要在 FastAPI 中串流 SSE,請在你的路徑操作函式(path operation function)中使用 `yield`,並設定 `response_class=EventSourceResponse`。
    
    從 `fastapi.sse` 匯入 `EventSourceResponse`:
    
    {* ../../docs_src/server_sent_events/tutorial001_py310.py ln[1:25] hl[4,22] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:33:04 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  3. tests/test_compat.py

    from fastapi import FastAPI, UploadFile
    from fastapi._compat import (
        Undefined,
        is_uploadfile_sequence_annotation,
    )
    from fastapi._compat.shared import is_bytes_sequence_annotation
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, ConfigDict
    from pydantic.fields import FieldInfo
    
    
    def test_model_field_default_required():
        from fastapi._compat import v2
    
        # For coverage
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  4. docs_src/custom_response/tutorial002_py310.py

    from fastapi import FastAPI
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.get("/items/", response_class=HTMLResponse)
    async def read_items():
        return """
        <html>
            <head>
                <title>Some HTML in here</title>
            </head>
            <body>
                <h1>Look ma! HTML!</h1>
            </body>
        </html>
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 352 bytes
    - Click Count (0)
  5. docs_src/custom_response/tutorial007_py310.py

    import anyio
    from fastapi import FastAPI
    from fastapi.responses import StreamingResponse
    
    app = FastAPI()
    
    
    async def fake_video_streamer():
        for i in range(10):
            yield b"some fake video bytes"
            await anyio.sleep(0)
    
    
    @app.get("/")
    async def main():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 19:12:46 GMT 2026
    - 319 bytes
    - Click Count (0)
  6. docs_src/custom_response/tutorial008_py310.py

    from fastapi import FastAPI
    from fastapi.responses import StreamingResponse
    
    some_file_path = "large-video-file.mp4"
    app = FastAPI()
    
    
    @app.get("/")
    def main():
        def iterfile():  # (1)
            with open(some_file_path, mode="rb") as file_like:  # (2)
                yield from file_like  # (3)
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 360 bytes
    - Click Count (0)
  7. docs/zh/docs/alternatives.md

    /// check | 启发 **FastAPI**:
    
    - 成为微框架,便于按需组合所需的工具与组件。
    - 提供简单易用的路由系统。
    
    ///
    
    ### [Requests](https://requests.readthedocs.io) { #requests }
    
    **FastAPI** 实际上不是 **Requests** 的替代品。它们的作用范围完全不同。
    
    在 FastAPI 应用程序内部使用 Requests 其实非常常见。
    
    尽管如此,FastAPI 依然从 Requests 中获得了不少灵感。
    
    **Requests** 是一个用于与 API 交互(作为客户端)的库,而 **FastAPI** 是一个用于构建 API(作为服务端)的库。
    
    它们处在某种意义上的“对立端”,彼此互补。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 20.1K bytes
    - Click Count (0)
  8. docs/zh/docs/advanced/generate-clients.md

    /// tip | 提示
    
    FastAPI 会自动生成 **OpenAPI 3.1** 规范,因此你使用的任何工具都必须支持该版本。
    
    ///
    
    ## 来自 FastAPI 赞助商的 SDK 生成器 { #sdk-generators-from-fastapi-sponsors }
    
    本节介绍的是由赞助 FastAPI 的公司提供的、具备**风险投资背景**或**公司支持**的方案。这些产品在高质量生成的 SDK 之上,提供了**更多特性**和**集成**。
    
    通过 ✨ [**赞助 FastAPI**](../help-fastapi.md#sponsor-the-author) ✨,这些公司帮助确保框架及其**生态**保持健康并且**可持续**。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 8.9K bytes
    - Click Count (0)
  9. tests/test_security_openid_connect_optional.py

    from fastapi import Depends, FastAPI, Security
    from fastapi.security.open_id_connect_url import OpenIdConnect
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from pydantic import BaseModel
    
    app = FastAPI()
    
    oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str | None = Security(oid)):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 2.6K bytes
    - Click Count (0)
  10. tests/test_ambiguous_params.py

    from typing import Annotated
    
    import pytest
    from fastapi import Depends, FastAPI, Path
    from fastapi.param_functions import Query
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    def test_no_annotated_defaults():
        with pytest.raises(
            AssertionError, match="Path parameters cannot have a default value"
        ):
    
            @app.get("/items/{item_id}/")
            async def get_item(item_id: Annotated[int, Path(default=1)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 2K bytes
    - Click Count (1)
Back to Top