- Sort Score
- Num 10 results
- Language All
Results 141 - 150 of 445 for item_1 (0.23 seconds)
-
docs_src/path_params_numeric_validations/tutorial006_py310.py
from fastapi import FastAPI, Path, Query app = FastAPI() @app.get("/items/{item_id}") async def read_items( *, item_id: int = Path(title="The ID of the item to get", ge=0, le=1000), q: str, size: 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 - 397 bytes - Click Count (0) -
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) -
tests/test_tutorial/test_body_nested_models/test_tutorial005.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 10.3K 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/pt/docs/tutorial/path-params.md
{* ../../docs_src/path_params/tutorial001_py310.py hl[6:7] *} O valor do parâmetro de path `item_id` será passado para a sua função como o argumento `item_id`. Então, se você executar este exemplo e acessar [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo), você verá uma resposta: ```JSON {"item_id":"foo"} ``` ## Parâmetros de path com tipos { #path-parameters-with-types }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:20:43 GMT 2026 - 9.5K bytes - Click Count (0) -
docs/zh/docs/tutorial/path-params.md
路径参数 `item_id` 的值会作为参数 `item_id` 传递给你的函数。 运行示例并访问 [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo),可获得如下响应: ```JSON {"item_id":"foo"} ``` ## 声明路径参数的类型 { #path-parameters-with-types } 使用 Python 标准类型注解,声明路径操作函数中路径参数的类型: {* ../../docs_src/path_params/tutorial002_py310.py hl[7] *} 本例把 `item_id` 的类型声明为 `int`。 /// check | 检查Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 7.6K 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)