- Sort Score
- Num 10 results
- Language All
Results 121 - 130 of 395 for item_1 (0.05 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs_src/extra_data_types/tutorial001_py310.py
app = FastAPI() @app.put("/items/{item_id}") async def read_items( item_id: UUID, start_datetime: datetime = Body(), end_datetime: datetime = Body(), process_after: timedelta = Body(), repeat_at: time | None = Body(default=None), ): start_process = start_datetime + process_after duration = end_datetime - start_process return { "item_id": item_id,
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Apr 19 00:11:40 GMT 2024 - 724 bytes - Click Count (0) -
docs_src/path_params_numeric_validations/tutorial006_an_py310.py
from typing import Annotated from fastapi import FastAPI, Path, Query app = FastAPI() @app.get("/items/{item_id}") async def read_items( *, item_id: Annotated[int, Path(title="The ID of the item to get", ge=0, le=1000)], q: str, size: Annotated[float, Query(gt=0, lt=10.5)], ): results = {"item_id": item_id} if q: results.update({"q": q}) if size: results.update({"size": size})
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 447 bytes - Click Count (0) -
docs_src/extra_data_types/tutorial001_an_py310.py
from datetime import datetime, time, timedelta from typing import Annotated from uuid import UUID from fastapi import Body, FastAPI app = FastAPI() @app.put("/items/{item_id}") async def read_items( item_id: UUID, start_datetime: Annotated[datetime, Body()], end_datetime: Annotated[datetime, Body()], process_after: Annotated[timedelta, Body()], repeat_at: Annotated[time | None, Body()] = None, ):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Apr 19 00:11:40 GMT 2024 - 788 bytes - Click Count (0) -
docs_src/body_multiple_params/tutorial001_py310.py
app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int = Path(title="The ID of the item to get", ge=0, le=1000), q: str | None = None, item: Item | None = None, ): results = {"item_id": item_id} if q: results.update({"q": q})
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 546 bytes - Click Count (0) -
docs/zh-hant/docs/python-types.md
/// info | 資訊 方括號裡的那些內部型別稱為「型別參數」。 在這個例子中,`str` 是傳給 `list` 的型別參數。 /// 這表示:「變數 `items` 是一個 `list`,而這個清單中的每個元素都是 `str`」。 這麼做之後,你的編輯器甚至在處理清單裡的項目時也能提供支援: <img src="/img/python-types/image05.png"> 沒有型別時,幾乎不可能做到這點。 請注意,變數 `item` 是清單 `items` 中的一個元素。 即便如此,編輯器仍然知道它是 `str`,並提供相應的支援。 #### Tuple 與 Set { #tuple-and-set } 你也可以用相同方式來宣告 `tuple` 與 `set`:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 10.7K bytes - Click Count (0) -
docs_src/dependencies/tutorial008b_an_py310.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 Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 775 bytes - Click Count (0) -
docs/fr/docs/index.md
app = FastAPI() class Item(BaseModel): name: str price: float is_offer: bool | None = None @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: 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 Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:37:13 GMT 2026 - 23.8K bytes - Click Count (0) -
docs_src/schema_extra_example/tutorial005_an_py310.py
from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Annotated[ Item, Body( openapi_examples={ "normal": {
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Aug 26 18:03:13 GMT 2023 - 1.5K bytes - Click Count (0) -
docs_src/app_testing/tutorial004_py310.py
from fastapi.testclient import TestClient items = {} @asynccontextmanager async def lifespan(app: FastAPI): items["foo"] = {"name": "Fighters"} items["bar"] = {"name": "Tenders"} yield # clean up items items.clear() app = FastAPI(lifespan=lifespan) @app.get("/items/{item_id}") async def read_items(item_id: str): return items[item_id] def test_read_items():Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 1.2K bytes - Click Count (0) -
docs_src/app_testing/app_b_py310/main.py
return fake_db[item_id] @app.post("/items/") async def create_item(item: Item, x_token: str = Header()) -> Item: 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.model_dump()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 13:32:24 GMT 2026 - 1.1K bytes - Click Count (0)