Search Options

Results per page
Sort
Preferred Languages
Advance

Results 311 - 320 of 1,976 for Fastapi (0.14 sec)

  1. tests/test_serialize_response.py

    from typing import List, Optional
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/valid", response_model=Item)
    def get_valid():
        return {"name": "valid", "price": 1.0}
    
    
    @app.get("/items/coerce", response_model=Item)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Aug 03 12:29:07 UTC 2020
    - 1.4K bytes
    - Viewed (0)
  2. docs_src/request_forms/tutorial001_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, Form
    
    app = FastAPI()
    
    
    @app.post("/login/")
    async def login(username: Annotated[str, Form()], password: Annotated[str, Form()]):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 223 bytes
    - Viewed (0)
  3. docs/em/docs/deployment/docker.md

    ---> 100%
    Successfully installed fastapi pydantic uvicorn
    ```
    
    </div>
    
    /// info
    
    📤 🎏 📁 &amp; 🧰 🔬 &amp; ❎ 📦 🔗.
    
    👤 🔜 🎦 👆 🖼 ⚙️ 🎶 ⏪ 📄 🔛. 👶
    
    ///
    
    ### ✍ **FastAPI** 📟
    
    * ✍ `app` 📁 &amp; ⛔ ⚫️.
    * ✍ 🛁 📁 `__init__.py`.
    * ✍ `main.py` 📁 ⏮️:
    
    ```Python
    from typing import Union
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Aug 12 21:47:53 UTC 2024
    - 27.9K bytes
    - Viewed (0)
  4. tests/test_dependency_contextvars.py

    from contextvars import ContextVar
    from typing import Any, Awaitable, Callable, Dict, Optional
    
    from fastapi import Depends, FastAPI, Request, Response
    from fastapi.testclient import TestClient
    
    legacy_request_state_context_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar(
        "legacy_request_state_context_var", default=None
    )
    
    app = FastAPI()
    
    
    async def set_up_request_state_dependency():
        request_state = {"user": "deadpond"}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Feb 17 12:40:12 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  5. tests/test_required_noneable.py

    from typing import Union
    
    from fastapi import Body, FastAPI, Query
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/query")
    def read_query(q: Union[str, None]):
        return q
    
    
    @app.get("/explicit-query")
    def read_explicit_query(q: Union[str, None] = Query()):
        return q
    
    
    @app.post("/body-embed")
    def send_body_embed(b: Union[str, None] = Body(embed=True)):
        return b
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 19:08:31 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial001_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: str | None = None):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 239 bytes
    - Viewed (0)
  7. docs_src/header_params/tutorial002_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI, Header
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        strange_header: Annotated[
            Union[str, None], Header(convert_underscores=False)
        ] = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 288 bytes
    - Viewed (0)
  8. tests/test_custom_swagger_ui_redirect.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    swagger_ui_oauth2_redirect_url = "/docs/redirect"
    
    app = FastAPI(swagger_ui_oauth2_redirect_url=swagger_ui_oauth2_redirect_url)
    
    
    @app.get("/items/")
    async def read_items():
        return {"id": "foo"}
    
    
    client = TestClient(app)
    
    
    def test_swagger_ui():
        response = client.get("/docs")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 1.1K bytes
    - Viewed (0)
  9. docs_src/custom_request_and_route/tutorial003.py

    import time
    from typing import Callable
    
    from fastapi import APIRouter, FastAPI, Request, Response
    from fastapi.routing import APIRoute
    
    
    class TimedRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                before = time.time()
                response: Response = await original_route_handler(request)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 1K bytes
    - Viewed (0)
  10. docs_src/async_tests/main.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    async def root():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 08 18:01:18 UTC 2020
    - 112 bytes
    - Viewed (0)
Back to top