Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 61 - 70 of 543 for item_d (0.04 seconds)

  1. tests/test_tutorial/test_handling_errors/test_tutorial006.py

            ]
        }
    
    
    def test_get_http_error():
        response = client.get("/items/3")
        assert response.status_code == 418, response.text
        assert response.json() == {"detail": "Nope! I don't like 3."}
    
    
    def test_get():
        response = client.get("/items/2")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": 2}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 3.6K bytes
    - Click Count (0)
  2. docs/zh/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
    - 18.2K bytes
    - Click Count (0)
  3. docs_src/response_model/tutorial006_py310.py

        },
    }
    
    
    @app.get(
        "/items/{item_id}/name",
        response_model=Item,
        response_model_include=["name", "description"],
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"])
    async def read_item_public_data(item_id: str):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 816 bytes
    - Click Count (0)
  4. docs_src/response_model/tutorial004_py310.py

    }
    
    
    @app.get("/items/{item_id}", response_model=Item, response_model_exclude_unset=True)
    async def read_item(item_id: str):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 595 bytes
    - Click Count (0)
  5. docs_src/extra_models/tutorial003_py39.py

        size: int
    
    
    items = {
        "item1": {"description": "All my friends drive a low rider", "type": "car"},
        "item2": {
            "description": "Music is my aeroplane, it's my aeroplane",
            "type": "plane",
            "size": 5,
        },
    }
    
    
    @app.get("/items/{item_id}", response_model=Union[PlaneItem, CarItem])
    async def read_item(item_id: str):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 644 bytes
    - Click Count (0)
  6. tests/test_tutorial/test_body_multiple_params/test_tutorial005.py

        response = client.put(
            "/items/5",
            json={
                "item": {
                    "name": "Foo",
                    "price": 50.5,
                    "description": "Some Foo",
                    "tax": 0.1,
                },
            },
        )
        assert response.status_code == 200
        assert response.json() == {
            "item_id": 5,
            "item": {
                "name": "Foo",
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 8.2K bytes
    - Click Count (0)
  7. docs_src/handling_errors/tutorial001_py39.py

    from fastapi import FastAPI, HTTPException
    
    app = FastAPI()
    
    items = {"foo": "The Foo Wrestlers"}
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str):
        if item_id not in items:
            raise HTTPException(status_code=404, detail="Item not found")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 299 bytes
    - Click Count (0)
  8. docs_src/body_nested_models/tutorial001_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: list = []
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 364 bytes
    - Click Count (0)
  9. docs_src/body/tutorial003_py39.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 368 bytes
    - Click Count (0)
  10. docs_src/handling_errors/tutorial002_py39.py

    app = FastAPI()
    
    items = {"foo": "The Foo Wrestlers"}
    
    
    @app.get("/items-header/{item_id}")
    async def read_item_header(item_id: str):
        if item_id not in items:
            raise HTTPException(
                status_code=404,
                detail="Item not found",
                headers={"X-Error": "There goes my error"},
            )
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 404 bytes
    - Click Count (0)
Back to Top