Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1221 - 1230 of 1,916 for FastApi (0.04 sec)

  1. tests/test_arbitrary_types.py

    from typing import Annotated
    
    import pytest
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    
    @pytest.fixture(name="client")
    def get_client():
        from pydantic import (
            BaseModel,
            ConfigDict,
            PlainSerializer,
            TypeAdapter,
            WithJsonSchema,
        )
    
        class FakeNumpyArray:
            def __init__(self):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_metadata/test_tutorial002.py

    from fastapi.testclient import TestClient
    
    from docs_src.metadata.tutorial002_py39 import app
    
    client = TestClient(app)
    
    
    def test_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"name": "Foo"}]
    
    
    def test_get_openapi_json_default_url():
        response = client.get("/openapi.json")
        assert response.status_code == 404, response.text
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.2K bytes
    - Viewed (0)
  3. docs_src/custom_request_and_route/tutorial001_an_py39.py

    import gzip
    from typing import Annotated, Callable
    
    from fastapi import Body, FastAPI, Request, Response
    from fastapi.routing import APIRoute
    
    
    class GzipRequest(Request):
        async def body(self) -> bytes:
            if not hasattr(self, "_body"):
                body = await super().body()
                if "gzip" in self.headers.getlist("Content-Encoding"):
                    body = gzip.decompress(body)
                self._body = body
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 10 08:55:32 UTC 2025
    - 988 bytes
    - Viewed (0)
  4. docs_src/generate_clients/tutorial003_py39.py

    from fastapi import FastAPI
    from fastapi.routing import APIRoute
    from pydantic import BaseModel
    
    
    def custom_generate_unique_id(route: APIRoute):
        return f"{route.tags[0]}-{route.name}"
    
    
    app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
    
    
    class Item(BaseModel):
        name: str
        price: float
    
    
    class ResponseMessage(BaseModel):
        message: str
    
    
    class User(BaseModel):
        username: str
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Mar 04 22:02:18 UTC 2022
    - 914 bytes
    - Viewed (0)
  5. tests/test_request_params/test_form/test_optional_list.py

    from typing import Annotated, Optional
    
    import pytest
    from fastapi import FastAPI, Form
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-list-str", operation_id="optional_list_str")
    async def read_optional_list_str(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9.9K bytes
    - Viewed (0)
  6. docs/zh/docs/advanced/additional-status-codes.md

    /// warning | 警告
    
    当你直接返回一个像上面例子中的 `Response` 对象时,它会直接返回。
    
    FastAPI 不会用模型等对该响应进行序列化。
    
    确保其中有你想要的数据,且返回的值为合法的 JSON(如果你使用 `JSONResponse` 的话)。
    
    ///
    
    /// note | 技术细节
    
    你也可以使用 `from starlette.responses import JSONResponse`。 
    
    出于方便,**FastAPI** 为开发者提供同 `starlette.responses` 一样的 `fastapi.responses`。但是大多数可用的响应都是直接来自 Starlette。`status` 也是一样。
    
    ///
    
    ## OpenAPI 和 API 文档
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  7. tests/test_filter_pydantic_sub_model_pv2.py

    import pytest
    from dirty_equals import HasRepr
    from fastapi import Depends, FastAPI
    from fastapi.exceptions import ResponseValidationError
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    
    @pytest.fixture(name="client")
    def get_client():
        from pydantic import BaseModel, ValidationInfo, field_validator
    
        app = FastAPI()
    
        class ModelB(BaseModel):
            username: str
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.6K bytes
    - Viewed (0)
  8. docs/ko/docs/tutorial/path-operation-configuration.md

    각 상태 코드들은 응답에 사용되며, OpenAPI 스키마에 추가됩니다.
    
    /// note | 기술적 세부사항
    
    다음과 같이 임포트하셔도 좋습니다. `from starlette import status`.
    
    **FastAPI**는 개발자 여러분의 편의를 위해서 `starlette.status`와 동일한 `fastapi.status`를 제공합니다. 하지만 Starlette에서 직접 온 것입니다.
    
    ///
    
    ## 태그
    
    (보통 단일 `str`인) `str`로 구성된 `list`와 함께 매개변수 `tags`를 전달하여, `경로 작동`에 태그를 추가할 수 있습니다:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  9. docs/es/docs/how-to/custom-docs-ui-assets.md

    Para desactivarlos, establece sus URLs en `None` cuando crees tu aplicación de `FastAPI`:
    
    {* ../../docs_src/custom_docs_ui/tutorial001_py39.py hl[8] *}
    
    ### Incluye la documentación personalizada { #include-the-custom-docs }
    
    Ahora puedes crear las *path operations* para la documentación personalizada.
    
    Puedes reutilizar las funciones internas de FastAPI para crear las páginas HTML para la documentación, y pasarles los argumentos necesarios:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 8.6K bytes
    - Viewed (0)
  10. docs/pt/docs/how-to/custom-docs-ui-assets.md

    Para desativá-los, defina suas URLs como `None` ao criar sua aplicação FastAPI:
    
    {* ../../docs_src/custom_docs_ui/tutorial001_py39.py hl[8] *}
    
    ### Incluir a documentação personalizada { #include-the-custom-docs }
    
    Agora você pode criar as *operações de rota* para a documentação personalizada.
    
    Você pode reutilizar as funções internas do FastAPI para criar as páginas HTML para a documentação e passar os argumentos necessários:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 8.8K bytes
    - Viewed (0)
Back to top