Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 151 - 160 of 378 for item_1 (0.03 seconds)

  1. docs_src/additional_responses/tutorial001_py39.py

    from fastapi.responses import JSONResponse
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        id: str
        value: str
    
    
    class Message(BaseModel):
        message: str
    
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})
    async def read_item(item_id: str):
        if item_id == "foo":
            return {"id": "foo", "value": "there goes my hero"}
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 506 bytes
    - Click Count (0)
  2. docs_src/dependencies/tutorial008b_an_py39.py

    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id not in data:
            raise HTTPException(status_code=404, detail="Item not found")
        item = data[item_id]
        if item["owner"] != username:
            raise OwnerError(username)
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Dec 26 20:37:34 GMT 2023
    - 775 bytes
    - Click Count (0)
  3. tests/test_ambiguous_params.py

        ):
    
            @app.get("/items/{item_id}/")
            async def get_item(item_id: Annotated[int, Path(default=1)]):
                pass  # pragma: nocover
    
        with pytest.raises(
            AssertionError,
            match=(
                "`Query` default value cannot be set in `Annotated` for 'item_id'. Set the"
                " default value with `=` instead."
            ),
        ):
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 2K bytes
    - Click Count (1)
  4. docs/ru/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Thu Dec 11 21:25:03 GMT 2025
    - 32K bytes
    - Click Count (0)
  5. docs_src/query_params_str_validations/tutorial010_an_py310.py

                deprecated=True,
            ),
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 622 bytes
    - Click Count (0)
  6. docs/tr/docs/tutorial/path-params.md

    {* ../../docs_src/path_params/tutorial001.py hl[6:7] *}
    
    Yol parametresi olan `item_id`'nin değeri, fonksiyonunuza `item_id` argümanı olarak aktarılacaktır.
    
    Eğer bu örneği çalıştırıp <a href="http://127.0.0.1:8000/items/foo" class="external-link" target="_blank">http://127.0.0.1:8000/items/foo</a> sayfasına giderseniz, şöyle bir çıktı ile karşılaşırsınız:
    
    ```JSON
    {"item_id":"foo"}
    ```
    
    ## Tip İçeren Yol Parametreleri
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sun Aug 31 10:29:01 GMT 2025
    - 10.5K bytes
    - Click Count (0)
  7. docs_src/additional_responses/tutorial002_py39.py

    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        id: str
        value: str
    
    
    app = FastAPI()
    
    
    @app.get(
        "/items/{item_id}",
        response_model=Item,
        responses={
            200: {
                "content": {"image/png": {}},
                "description": "Return the JSON item or an image.",
            }
        },
    )
    async def read_item(item_id: str, img: Union[bool, None] = None):
        if img:
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 628 bytes
    - Click Count (0)
  8. tests/test_tutorial/test_body_nested_models/test_tutorial006.py

            "paths": {
                "/items/{item_id}": {
                    "put": {
                        "parameters": [
                            {
                                "in": "path",
                                "name": "item_id",
                                "required": True,
                                "schema": {
                                    "title": "Item Id",
                                    "type": "integer",
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 8.7K bytes
    - Click Count (0)
  9. docs_src/additional_responses/tutorial004_py39.py

    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        id: str
        value: str
    
    
    responses = {
        404: {"description": "Item not found"},
        302: {"description": "The item was moved"},
        403: {"description": "Not enough privileges"},
    }
    
    
    app = FastAPI()
    
    
    @app.get(
        "/items/{item_id}",
        response_model=Item,
        responses={**responses, 200: {"content": {"image/png": {}}}},
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 701 bytes
    - Click Count (0)
  10. docs/ko/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Oct 11 17:48:49 GMT 2025
    - 19.7K bytes
    - Click Count (0)
Back to Top