Search Options

Results per page
Sort
Preferred Languages
Advance

Results 131 - 140 of 527 for item_1 (0.03 sec)

  1. docs_src/additional_status_codes/tutorial001_py39.py

    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Union[str, None] = Body(default=None),
        size: Union[int, None] = Body(default=None),
    ):
        if item_id in items:
            item = items[item_id]
            item["name"] = name
            item["size"] = size
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 684 bytes
    - Viewed (0)
  2. docs_src/body_multiple_params/tutorial003_py39.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, user: User, importance: int = Body()):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 548 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/schema_extra_example/tutorial004_py39.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item = Body(
            examples=[
                {
                    "name": "Foo",
                    "description": "A very nice Item",
                    "price": 35.4,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 824 bytes
    - Viewed (0)
  5. docs_src/body_fields/tutorial001_py39.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = Field(
            default=None, title="The description of the item", max_length=300
        )
        price: float = Field(gt=0, description="The price must be greater than zero")
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item = Body(embed=True)):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 561 bytes
    - Viewed (0)
  6. docs_src/body_multiple_params/tutorial001_py310.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int = Path(title="The ID of the item to get", ge=0, le=1000),
        q: str | None = None,
        item: Item | None = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 546 bytes
    - Viewed (0)
  7. tests/test_validation_error_context.py

        await websocket.close()  # pragma: no cover
    
    
    @sub_app.websocket("/ws/{item_id}")
    async def subapp_websocket_endpoint(websocket: WebSocket, item_id: int):
        await websocket.accept()  # pragma: no cover
        await websocket.send_text(f"Item: {item_id}")  # pragma: no cover
        await websocket.close()  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 06 12:21:57 UTC 2025
    - 4.7K bytes
    - Viewed (0)
  8. docs_src/body_fields/tutorial001_an_py39.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = Field(
            default=None, title="The description of the item", max_length=300
        )
        price: float = Field(gt=0, description="The price must be greater than zero")
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Annotated[Item, Body(embed=True)]):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 582 bytes
    - Viewed (0)
  9. docs_src/path_params/tutorial002_py39.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 143 bytes
    - Viewed (0)
  10. docs_src/query_params/tutorial002_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str, q: str | None = None):
        if q:
            return {"item_id": item_id, "q": q}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 219 bytes
    - Viewed (0)
Back to top