Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 3,476 for item$ (0.04 sec)

  1. docs_src/bigger_applications/app_an_py39/routers/items.py

    from fastapi import APIRouter, Depends, HTTPException
    
    from ..dependencies import get_token_header
    
    router = APIRouter(
        prefix="/items",
        tags=["items"],
        dependencies=[Depends(get_token_header)],
        responses={404: {"description": "Not found"}},
    )
    
    
    fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}}
    
    
    @router.get("/")
    async def read_items():
        return fake_items_db
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 1011 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_path_operation_configurations/test_tutorial005.py

                        },
                        "summary": "Create an item",
                        "description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item",
                        "operationId": "create_item_items__post",
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Sep 28 04:14:40 UTC 2023
    - 8.7K bytes
    - Viewed (0)
  3. src/container/heap/example_pq_test.go

    	i := 0
    	for value, priority := range items {
    		pq[i] = &Item{
    			value:    value,
    			priority: priority,
    			index:    i,
    		}
    		i++
    	}
    	heap.Init(&pq)
    
    	// Insert a new item and then modify its priority.
    	item := &Item{
    		value:    "orange",
    		priority: 1,
    	}
    	heap.Push(&pq, item)
    	pq.update(item, item.value, 5)
    
    	// Take the items out; they arrive in decreasing priority order.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 20:27:36 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  4. docs_src/app_testing/app_b_an/main.py

            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: Annotated[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=400, detail="Item already exists")
        fake_db[item.id] = item
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 1.2K 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})
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 5.2K bytes
    - Viewed (0)
  6. docs_src/response_model/tutorial001_01_py310.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: list[str] = []
    
    
    @app.post("/items/")
    async def create_item(item: Item) -> Item:
        return item
    
    
    @app.get("/items/")
    async def read_items() -> list[Item]:
        return [
            Item(name="Portal Gun", price=42.0),
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 469 bytes
    - Viewed (0)
  7. docs_src/path_operation_configuration/tutorial005.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.post(
        "/items/",
        response_model=Item,
        summary="Create an item",
        response_description="The created item",
    )
    async def create_item(item: Item):
        """
        Create an item with all the information:
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 741 bytes
    - Viewed (0)
  8. docs_src/response_model/tutorial001_01.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: List[str] = []
    
    
    @app.post("/items/")
    async def create_item(item: Item) -> Item:
        return item
    
    
    @app.get("/items/")
    async def read_items() -> List[Item]:
        return [
            Item(name="Portal Gun", price=42.0),
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 513 bytes
    - Viewed (0)
  9. docs_src/separate_openapi_schemas/tutorial001.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> List[Item]:
        return [
            Item(
                name="Portal Gun",
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 489 bytes
    - Viewed (0)
  10. docs_src/body_updates/tutorial002_py310.py

    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.patch("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        stored_item_data = items[item_id]
        stored_item_model = Item(**stored_item_data)
        update_data = item.dict(exclude_unset=True)
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 1010 bytes
    - Viewed (0)
Back to top