Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1171 - 1180 of 1,916 for FastApi (0.21 sec)

  1. tests/test_schema_extra_examples.py

    from typing import Union
    
    import pytest
    from fastapi import Body, Cookie, FastAPI, Header, Path, Query
    from fastapi.exceptions import FastAPIDeprecationWarning
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, ConfigDict
    
    
    def create_app():
        app = FastAPI()
    
        class Item(BaseModel):
            data: str
    
            model_config = ConfigDict(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 32.2K bytes
    - Viewed (0)
  2. docs_src/custom_response/tutorial006c_py39.py

    from fastapi import FastAPI
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/pydantic", response_class=RedirectResponse, status_code=302)
    async def redirect_pydantic():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 237 bytes
    - Viewed (0)
  3. tests/test_regex_deprecated_body.py

    from typing import Annotated
    
    import pytest
    from fastapi import FastAPI, Form
    from fastapi.exceptions import FastAPIDeprecationWarning
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    from .utils import needs_py310
    
    
    def get_client():
        app = FastAPI()
        with pytest.warns(FastAPIDeprecationWarning):
    
            @app.post("/items/")
            async def read_items(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  4. docs/pt/docs/tutorial/header-param-models.md

    Isso é possível desde a versão `0.115.0` do FastAPI. 🤓
    
    ///
    
    ## Parâmetros do Cabeçalho com um Modelo Pydantic { #header-parameters-with-a-pydantic-model }
    
    Declare os **parâmetros de cabeçalho** que você precisa em um **modelo do Pydantic**, e então declare o parâmetro como `Header`:
    
    {* ../../docs_src/header_param_models/tutorial001_an_py310.py hl[9:14,18] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 12 16:23:57 UTC 2025
    - 2.9K bytes
    - Viewed (0)
  5. docs/es/docs/tutorial/header-param-models.md

    /// note | Nota
    
    Esto es compatible desde la versión `0.115.0` de FastAPI. 🤓
    
    ///
    
    ## Parámetros de Header con un Modelo Pydantic { #header-parameters-with-a-pydantic-model }
    
    Declara los **parámetros de header** que necesitas en un **modelo Pydantic**, y luego declara el parámetro como `Header`:
    
    {* ../../docs_src/header_param_models/tutorial001_an_py310.py hl[9:14,18] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 2.8K bytes
    - Viewed (0)
  6. docs/zh/docs/advanced/advanced-dependencies.md

    这里说的不是类本身(类本就是可调用项),而是类实例。
    
    为此,需要声明 `__call__` 方法:
    
    {* ../../docs_src/dependencies/tutorial011.py hl[10] *}
    
    本例中,**FastAPI**  使用 `__call__` 检查附加参数及子依赖项,稍后,还要调用它向*路径操作函数*传递值。
    
    ## 参数化实例
    
    接下来,使用 `__init__` 声明用于**参数化**依赖项的实例参数:
    
    {* ../../docs_src/dependencies/tutorial011.py hl[7] *}
    
    本例中,**FastAPI** 不使用 `__init__`,我们要直接在代码中使用。
    
    ## 创建实例
    
    使用以下代码创建类实例:
    
    {* ../../docs_src/dependencies/tutorial011.py hl[16] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/query-param-models.md

    如果你有一组具有相关性的**查询参数**,你可以创建一个 **Pydantic 模型**来声明它们。
    
    这将允许你在**多个地方**去**复用模型**,并且一次性为所有参数声明验证和元数据。😎
    
    /// note
    
    FastAPI 从 `0.115.0` 版本开始支持这个特性。🤓
    
    ///
    
    ## 使用 Pydantic 模型的查询参数
    
    在一个 **Pydantic 模型**中声明你需要的**查询参数**,然后将参数声明为 `Query`:
    
    {* ../../docs_src/query_param_models/tutorial001_an_py310.py hl[9:13,17] *}
    
    **FastAPI** 将会从请求的**查询参数**中**提取**出**每个字段**的数据,并将其提供给你定义的 Pydantic 模型。
    
    ## 查看文档
    
    你可以在 `/docs` 页面的 UI 中查看查询参数:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Nov 26 22:06:31 UTC 2024
    - 2K bytes
    - Viewed (0)
  8. docs_src/response_model/tutorial003_03_py39.py

    from fastapi import FastAPI
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/teleport")
    async def get_teleport() -> RedirectResponse:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 241 bytes
    - Viewed (0)
  9. docs/ko/docs/tutorial/dependencies/index.md

    ## 간단한 사용법
    
    이를 보면, *경로 작동 함수*는 *경로*와 *작동*이 매칭되면 언제든지 사용되도록 정의되었으며, **FastAPI**는 올바른 매개변수를 가진 함수를 호출하고 해당 요청에서 데이터를 추출합니다.
    
    사실, 모든 (혹은 대부분의) 웹 프레임워크는 이와 같은 방식으로 작동합니다.
    
    여러분은 이러한 함수들을 절대 직접 호출하지 않습니다. 프레임워크(이 경우 **FastAPI**)에 의해 호출됩니다.
    
    의존성 주입 시스템과 함께라면 **FastAPI**에게 여러분의 *경로 작동 함수*가 실행되기 전에 실행되어야 하는 무언가에 여러분의 *경로 작동 함수* 또한 "의존"하고 있음을 알릴 수 있으며, **FastAPI**는 이를 실행하고 결과를 "주입"할 것입니다.
    
    "의존성 주입"이라는 동일한 아이디어에 대한 다른 일반적인 용어는 다음과 같습니다:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_behind_a_proxy/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.behind_a_proxy.tutorial001_py39 import app
    
    client = TestClient(app, root_path="/api/v1")
    
    
    def test_main():
        response = client.get("/app")
        assert response.status_code == 200
        assert response.json() == {"message": "Hello World", "root_path": "/api/v1"}
    
    
    def test_openapi():
        response = client.get("/openapi.json")
        assert response.status_code == 200
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1K bytes
    - Viewed (0)
Back to top