Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 524 for item_b (0.04 sec)

  1. 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",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 8.2K bytes
    - Viewed (0)
  2. tests/test_starlette_exception.py

    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",
                headers={"X-Error": "Some custom header"},
            )
        return {"item": items[item_id]}
    
    
    @app.get("/http-no-body-statuscode-exception")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 7.4K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_body_fields/test_tutorial001.py

    def test_items_5(client: TestClient):
        response = client.put("/items/5", json={"item": {"name": "Foo", "price": 3.0}})
        assert response.status_code == 200
        assert response.json() == {
            "item_id": 5,
            "item": {"name": "Foo", "price": 3.0, "description": None, "tax": None},
        }
    
    
    def test_items_6(client: TestClient):
        response = client.put(
            "/items/6",
            json={
                "item": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.3K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_body_nested_models/test_tutorial001_tutorial002_tutorial003.py

            "paths": {
                "/items/{item_id}": {
                    "put": {
                        "parameters": [
                            {
                                "in": "path",
                                "name": "item_id",
                                "required": True,
                                "schema": {
                                    "title": "Item Id",
                                    "type": "integer",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7.9K bytes
    - Viewed (0)
  5. docs_src/body_updates/tutorial001_py310.py

    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.put("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        update_item_encoded = jsonable_encoder(item)
        items[item_id] = update_item_encoded
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 856 bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial008_an_py39.py

    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[
            Union[str, None],
            Query(
                title="Query string",
                description="Query string for the items to search in the database that have a good match",
                min_length=3,
            ),
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 511 bytes
    - Viewed (0)
  7. docs_src/query_params_str_validations/tutorial010_an_py39.py

                deprecated=True,
            ),
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 635 bytes
    - Viewed (0)
  8. docs_src/query_params_str_validations/tutorial010_py39.py

        ),
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 574 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_body_multiple_params/test_tutorial004.py

        response = client.put(
            "/items/5",
            json={
                "importance": 2,
                "item": {"name": "Foo", "price": 50.5},
                "user": {"username": "Dave"},
            },
            params={"q": "somequery"},
        )
        assert response.status_code == 200
        assert response.json() == {
            "item_id": 5,
            "importance": 2,
            "item": {
                "name": "Foo",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  10. docs_src/app_testing/app_b_py310/main.py

        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: str = Header()):
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item.id in fake_db:
            raise HTTPException(status_code=409, detail="Item already exists")
        fake_db[item.id] = item
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Jan 09 14:44:08 UTC 2024
    - 1.1K bytes
    - Viewed (0)
Back to top