Search Options

Results per page
Sort
Preferred Languages
Advance

Results 201 - 210 of 274 for head_item (0.04 sec)

  1. docs_src/path_operation_configuration/tutorial002_py310.py

        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 537 bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial003_py310.py

    class CommonQueryParams:
        def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100):
            self.q = q
            self.skip = skip
            self.limit = limit
    
    
    @app.get("/items/")
    async def read_items(commons=Depends(CommonQueryParams)):
        response = {}
        if commons.q:
            response.update({"q": commons.q})
        items = fake_items_db[commons.skip : commons.skip + commons.limit]
        response.update({"items": items})
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 603 bytes
    - Viewed (0)
  3. docs_src/extra_data_types/tutorial001_an_py310.py

    from datetime import datetime, time, timedelta
    from typing import Annotated
    from uuid import UUID
    
    from fastapi import Body, FastAPI
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def read_items(
        item_id: UUID,
        start_datetime: Annotated[datetime, Body()],
        end_datetime: Annotated[datetime, Body()],
        process_after: Annotated[timedelta, Body()],
        repeat_at: Annotated[time | None, Body()] = None,
    ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Apr 19 00:11:40 UTC 2024
    - 788 bytes
    - Viewed (0)
  4. docs_src/query_params_str_validations/tutorial010_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[
            Union[str, None],
            Query(
                alias="item-query",
                title="Query string",
                description="Query string for the items to search in the database that have a good match",
                min_length=3,
                max_length=50,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 635 bytes
    - Viewed (0)
  5. docs_src/query_params_str_validations/tutorial010_py39.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Union[str, None] = Query(
            default=None,
            alias="item-query",
            title="Query string",
            description="Query string for the items to search in the database that have a good match",
            min_length=3,
            max_length=50,
            pattern="^fixedquery$",
            deprecated=True,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 574 bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial015_an_py310.py

    
    def check_valid_id(id: str):
        if not id.startswith(("isbn-", "imdb-")):
            raise ValueError('Invalid ID format, it must start with "isbn-" or "imdb-"')
        return id
    
    
    @app.get("/items/")
    async def read_items(
        id: Annotated[str | None, AfterValidator(check_valid_id)] = None,
    ):
        if id:
            item = data.get(id)
        else:
            id, item = random.choice(list(data.items()))
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 01 22:02:35 UTC 2025
    - 768 bytes
    - Viewed (0)
  7. docs_src/response_model/tutorial001_py310.py

        tags: list[str] = []
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item) -> Any:
        return item
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items() -> Any:
        return [
            {"name": "Portal Gun", "price": 42.0},
            {"name": "Plumbus", "price": 32.0},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 537 bytes
    - Viewed (0)
  8. docs_src/query_params_str_validations/tutorial010_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[
            str | None,
            Query(
                alias="item-query",
                title="Query string",
                description="Query string for the items to search in the database that have a good match",
                min_length=3,
                max_length=50,
                pattern="^fixedquery$",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 622 bytes
    - Viewed (0)
  9. docs_src/app_testing/tutorial004_py39.py

        items["bar"] = {"name": "Tenders"}
        yield
        # clean up items
        items.clear()
    
    
    app = FastAPI(lifespan=lifespan)
    
    
    @app.get("/items/{item_id}")
    async def read_items(item_id: str):
        return items[item_id]
    
    
    def test_read_items():
        # Before the lifespan starts, "items" is still empty
        assert items == {}
    
        with TestClient(app) as client:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.2K bytes
    - Viewed (0)
  10. tests/test_custom_swagger_ui_redirect.py

    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 Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 1.1K bytes
    - Viewed (0)
Back to top