Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 1,738 for item (0.17 sec)

  1. docs_src/body_multiple_params/tutorial005_an_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
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Annotated[Item, Body(embed=True)]):
        results = {"item_id": item_id, "item": item}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 428 bytes
    - Viewed (0)
  2. docs_src/body_nested_models/tutorial003.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 414 bytes
    - Viewed (0)
  3. docs_src/query_params/tutorial003_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str, q: str | None = None, short: bool = False):
        item = {"item_id": item_id}
        if q:
            item.update({"q": q})
        if not short:
            item.update(
                {"description": "This is an amazing item that has a long description"}
            )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 374 bytes
    - Viewed (0)
  4. docs_src/query_params/tutorial004.py

    app = FastAPI()
    
    
    @app.get("/users/{user_id}/items/{item_id}")
    async def read_user_item(
        user_id: int, item_id: str, q: Union[str, None] = None, short: bool = False
    ):
        item = {"item_id": item_id, "owner_id": user_id}
        if q:
            item.update({"q": q})
        if not short:
            item.update(
                {"description": "This is an amazing item that has a long description"}
            )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 468 bytes
    - Viewed (0)
  5. tests/test_union_inherited_body.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Optional[str] = None
    
    
    class ExtendedItem(Item):
        age: int
    
    
    @app.post("/items/")
    def save_union_different_body(item: Union[ExtendedItem, Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_post_extended_item():
        response = client.post("/items/", json={"name": "Foo", "age": 5})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_body_multiple_params/test_tutorial001_an.py

                        },
                        "summary": "Update Item",
                        "operationId": "update_item_items__item_id__put",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {
                                    "title": "The ID of the item to get",
                                    "maximum": 1000.0,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.5K bytes
    - Viewed (0)
  7. docs_src/body_multiple_params/tutorial004_py310.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    class User(BaseModel):
        username: str
        full_name: str | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item,
        user: User,
        importance: int = Body(gt=0),
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 10 18:49:18 GMT 2023
    - 603 bytes
    - Viewed (0)
  8. docs_src/body_multiple_params/tutorial004_an.py

    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,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 703 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_body_fields/test_tutorial001_an_py310.py

                        },
                    },
                    "Body_update_item_items__item_id__put": {
                        "title": "Body_update_item_items__item_id__put",
                        "required": ["item"],
                        "type": "object",
                        "properties": {"item": {"$ref": "#/components/schemas/Item"}},
                    },
                    "ValidationError": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_dependencies/test_tutorial004.py

                        {"item_name": "Baz"},
                    ],
                    "q": "foo",
                },
            ),
            (
                "/items?q=foo&skip=1",
                200,
                {"items": [{"item_name": "Bar"}, {"item_name": "Baz"}], "q": "foo"},
            ),
            (
                "/items?q=bar&limit=2",
                200,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.4K bytes
    - Viewed (0)
Back to top