Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1191 - 1200 of 1,992 for Fastapi (0.04 sec)

  1. 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)
  2. docs/ru/docs/tutorial/request-forms.md

    ```console
    $ pip install python-multipart
    ```
    
    ///
    
    ## Импорт `Form` { #import-form }
    
    Импортируйте `Form` из `fastapi`:
    
    {* ../../docs_src/request_forms/tutorial001_an_py39.py hl[3] *}
    
    ## Определение параметров `Form` { #define-form-parameters }
    
    Создайте параметры формы так же, как это делается для `Body` или `Query`:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Sep 30 11:24:39 UTC 2025
    - 4.4K bytes
    - Viewed (0)
  3. tests/test_openapi_query_parameter_extension.py

    from typing import Optional
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get(
        "/",
        openapi_extra={
            "parameters": [
                {
                    "required": False,
                    "schema": {"title": "Extra Param 1"},
                    "name": "extra_param_1",
                    "in": "query",
                },
                {
                    "required": True,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 4.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_custom_response/test_tutorial006c.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_response.tutorial006c_py39 import app
    
    client = TestClient(app)
    
    
    def test_redirect_status_code():
        response = client.get("/pydantic", follow_redirects=False)
        assert response.status_code == 302
        assert response.headers["location"] == "https://docs.pydantic.dev/"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 904 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.path_operation_advanced_configuration.tutorial005_py39 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_static_files/test_tutorial001.py

    import os
    from pathlib import Path
    
    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(scope="module")
    def client():
        static_dir: Path = Path(os.getcwd()) / "static"
        static_dir.mkdir(exist_ok=True)
        sample_file = static_dir / "sample.txt"
        sample_file.write_text("This is a sample static file.")
        from docs_src.static_files.tutorial001_py39 import app
    
        with TestClient(app) as client:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/response-directly.md

    # Return a Response Directly { #return-a-response-directly }
    
    When you create a **FastAPI** *path operation* you can normally return any data from it: a `dict`, a `list`, a Pydantic model, a database model, etc.
    
    By default, **FastAPI** would automatically convert that return value to JSON using the `jsonable_encoder` explained in [JSON Compatible Encoder](../tutorial/encoder.md){.internal-link target=_blank}.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 3.1K bytes
    - Viewed (0)
  8. docs/ru/docs/tutorial/query-params-str-validations.md

    Чтобы сделать это, сначала импортируйте:
    
    * `Query` из `fastapi`
    * `Annotated` из `typing`
    
    {* ../../docs_src/query_params_str_validations/tutorial002_an_py310.py hl[1,3] *}
    
    /// info | Дополнительная информация
    
    Поддержка `Annotated` (и рекомендация использовать его) появилась в FastAPI версии 0.95.0.
    
    Если у вас более старая версия, при попытке использовать `Annotated` вы получите ошибки.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 26.2K bytes
    - Viewed (0)
  9. docs/pt/docs/advanced/security/oauth2-scopes.md

    Nós estamos fazendo isso aqui para demonstrar como o **FastAPI** lida com escopos declarados em diferentes níveis.
    
    ///
    
    {* ../../docs_src/security/tutorial005_an_py310.py hl[5,141,172] *}
    
    /// info | Detalhes Técnicos
    
    `Security` é na verdade uma subclasse de `Depends`, e ele possui apenas um parâmetro extra que veremos depois.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 12 16:23:57 UTC 2025
    - 14.9K bytes
    - Viewed (0)
  10. docs_src/security/tutorial002_py310.py

    from fastapi import Depends, FastAPI
    from fastapi.security import OAuth2PasswordBearer
    from pydantic import BaseModel
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    class User(BaseModel):
        username: str
        email: str | None = None
        full_name: str | None = None
        disabled: bool | None = None
    
    
    def fake_decode_token(token):
        return User(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 711 bytes
    - Viewed (0)
Back to top