- Sort Score
- Result 10 results
- Languages All
Results 51 - 60 of 3,476 for item$ (0.08 sec)
-
docs_src/app_testing/app_b_an_py310/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.1K bytes - Viewed (0) -
docs_src/additional_status_codes/tutorial001_an.py
app = FastAPI() items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}} @app.put("/items/{item_id}") async def upsert_item( item_id: str, name: Annotated[Union[str, None], Body()] = None, size: Annotated[Union[int, None], Body()] = None, ): if item_id in items: item = items[item_id] item["name"] = name item["size"] = size
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 734 bytes - Viewed (0) -
tests/test_invalid_sequence_param.py
app = FastAPI() class Item(BaseModel): title: str @app.get("/items/") def read_items(q: List[Item] = Query(default=None)): pass # pragma: no cover def test_invalid_tuple(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str @app.get("/items/")
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 1.2K bytes - Viewed (0) -
docs_src/separate_openapi_schemas/tutorial002.py
from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: Union[str, None] = None app = FastAPI(separate_input_output_schemas=False) @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 - 524 bytes - Viewed (0) -
tests/test_tutorial/test_schema_extra_example/test_tutorial001.py
client = TestClient(app) return client @needs_pydanticv2 def test_post_body_example(client: TestClient): response = client.put( "/items/5", json={ "name": "Foo", "description": "A very nice Item", "price": 35.4, "tax": 3.2, }, ) assert response.status_code == 200 @needs_pydanticv2
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.7K bytes - Viewed (0) -
scripts/mkdocs_hooks.py
) ) def resolve_files(*, items: List[Any], files: Files, config: MkDocsConfig) -> None: for item in items: if isinstance(item, str): resolve_file(item=item, files=files, config=config) elif isinstance(item, dict): assert len(item) == 1 values = list(item.values()) if not values: continue
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 5.1K bytes - Viewed (0) -
docs_src/body_updates/tutorial002_py39.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: Sat May 14 11:59:59 UTC 2022 - 1K bytes - Viewed (0) -
docs_src/body_nested_models/tutorial001.py
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 402 bytes - Viewed (0) -
docs_src/body_multiple_params/tutorial005.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: Item = Body(embed=True)): results = {"item_id": item_id, "item": item}
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 407 bytes - Viewed (0) -
docs_src/path_operation_configuration/tutorial004_py39.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") async def create_item(item: Item): """ Create an item with all the information: - **name**: each item must have a name
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 676 bytes - Viewed (0)