Search Options

Results per page
Sort
Preferred Languages
Advance

Results 161 - 170 of 1,976 for Fastapi (0.05 sec)

  1. docs_src/advanced_middleware/tutorial002.py

    from fastapi import FastAPI
    from fastapi.middleware.trustedhost import TrustedHostMiddleware
    
    app = FastAPI()
    
    app.add_middleware(
        TrustedHostMiddleware, allowed_hosts=["example.com", "*.example.com"]
    )
    
    
    @app.get("/")
    async def main():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 279 bytes
    - Viewed (0)
  2. tests/test_additional_responses_default_validationerror.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/a/{id}")
    async def a(id):
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.8K bytes
    - Viewed (0)
  3. tests/test_duplicate_models_openapi.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Model(BaseModel):
        pass
    
    
    class Model2(BaseModel):
        a: Model
    
    
    class Model3(BaseModel):
        c: Model
        d: Model2
    
    
    @app.get("/", response_model=Model3)
    def f():
        return {"c": {}, "d": {"a": {}}}
    
    
    client = TestClient(app)
    
    
    def test_get_api_route():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  4. tests/test_custom_route_class.py

    import pytest
    from fastapi import APIRouter, FastAPI
    from fastapi.routing import APIRoute
    from fastapi.testclient import TestClient
    from starlette.routing import Route
    
    app = FastAPI()
    
    
    class APIRouteA(APIRoute):
        x_type = "A"
    
    
    class APIRouteB(APIRoute):
        x_type = "B"
    
    
    class APIRouteC(APIRoute):
        x_type = "C"
    
    
    router_a = APIRouter(route_class=APIRouteA)
    router_b = APIRouter(route_class=APIRouteB)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/body-multiple-params.md

    Por exemplo, extendendo o modelo anterior, você poder decidir por ter uma outra chave `importance` no mesmo corpo, além de `item` e `user`.
    
    Se você declará-lo como é, porque é um valor singular, o **FastAPI** assumirá que se trata de um parâmetro de consulta.
    
    Mas você pode instruir o **FastAPI** para tratá-lo como outra chave do corpo usando `Body`:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6K bytes
    - Viewed (0)
  6. docs/en/docs/project-generation.md

    ## Full Stack FastAPI Template - Technology Stack and Features
    
    - ⚡ [**FastAPI**](https://fastapi.tiangolo.com) for the Python backend API.
        - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) for the Python SQL database interactions (ORM).
        - 🔍 [Pydantic](https://docs.pydantic.dev), used by FastAPI, for the data validation and settings management.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Oct 04 11:16:34 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  7. docs_src/app_testing/tutorial003.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    items = {}
    
    
    @app.on_event("startup")
    async def startup_event():
        items["foo"] = {"name": "Fighters"}
        items["bar"] = {"name": "Tenders"}
    
    
    @app.get("/items/{item_id}")
    async def read_items(item_id: str):
        return items[item_id]
    
    
    def test_read_items():
        with TestClient(app) as client:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 528 bytes
    - Viewed (0)
  8. tests/test_router_prefix_with_template.py

    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    @router.get("/users/{id}")
    def read_user(segment: str, id: str):
        return {"segment": segment, "id": id}
    
    
    app.include_router(router, prefix="/{segment}")
    
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/seg/users/foo")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 484 bytes
    - Viewed (0)
  9. docs/vi/docs/tutorial/first-steps.md

    `FastAPI` là một class kế thừa trực tiếp `Starlette`.
    
    Bạn cũng có thể sử dụng tất cả <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> chức năng với `FastAPI`.
    
    ///
    
    ### Bước 2: Tạo một `FastAPI` "instance"
    
    ```Python hl_lines="3"
    {!../../docs_src/first_steps/tutorial001.py!}
    ```
    
    Biến `app` này là một "instance" của class `FastAPI`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  10. docs_src/response_model/tutorial003_04_py310.py

    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Response | dict:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Jan 10 16:22:47 UTC 2023
    - 352 bytes
    - Viewed (0)
Back to top