- Sort Score
- Num 10 results
- Language All
Results 61 - 70 of 378 for item_1 (0.04 seconds)
-
tests/test_tutorial/test_handling_errors/test_tutorial006.py
] } def test_get_http_error(): response = client.get("/items/3") assert response.status_code == 418, response.text assert response.json() == {"detail": "Nope! I don't like 3."} def test_get(): response = client.get("/items/2") assert response.status_code == 200, response.text assert response.json() == {"item_id": 2} def test_openapi_schema(): response = client.get("/openapi.json")Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 3.6K bytes - Click Count (0) -
docs/zh/docs/index.md
使用浏览器访问 <a href="http://127.0.0.1:8000/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1:8000/items/5?q=somequery</a>。 你将会看到如下 JSON 响应: ```JSON {"item_id": 5, "q": "somequery"} ``` 你已经创建了一个具有以下功能的 API: * 通过 _路径_ `/` 和 `/items/{item_id}` 接受 HTTP 请求。 * 以上 _路径_ 都接受 `GET` 操作(也被称为 HTTP _方法_)。 * `/items/{item_id}` _路径_ 有一个 _路径参数_ `item_id` 并且应该为 `int` 类型。
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Oct 11 17:48:49 GMT 2025 - 18.2K bytes - Click Count (0) -
docs_src/response_model/tutorial006_py310.py
}, } @app.get( "/items/{item_id}/name", response_model=Item, response_model_include=["name", "description"], ) async def read_item_name(item_id: str): return items[item_id] @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"]) async def read_item_public_data(item_id: str):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 816 bytes - Click Count (0) -
docs_src/response_model/tutorial004_py310.py
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 595 bytes - Click Count (0) -
docs_src/handling_errors/tutorial001_py39.py
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 299 bytes - Click Count (0) -
docs_src/body_nested_models/tutorial001_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None tags: list = [] @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item): results = {"item_id": item_id, "item": item}
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 364 bytes - Click Count (0) -
docs_src/body/tutorial003_py39.py
from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None app = FastAPI() @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item):Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 368 bytes - Click Count (0) -
docs_src/handling_errors/tutorial002_py39.py
app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items-header/{item_id}") async def read_item_header(item_id: str): if item_id not in items: raise HTTPException( status_code=404, detail="Item not found", headers={"X-Error": "There goes my error"}, )
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 404 bytes - Click Count (0) -
tests/test_tutorial/test_body_multiple_params/test_tutorial001.py
def test_post_no_body_q_bar(client: TestClient): response = client.put("/items/5?q=bar", json=None) assert response.status_code == 200 assert response.json() == {"item_id": 5, "q": "bar"} def test_post_no_body(client: TestClient): response = client.put("/items/5", json=None) assert response.status_code == 200 assert response.json() == {"item_id": 5} def test_post_id_foo(client: TestClient):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 6.3K bytes - Click Count (0) -
docs_src/body_nested_models/tutorial003_py39.py
from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: set[str] = set() @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item): results = {"item_id": item_id, "item": item}
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 409 bytes - Click Count (0)