- Sort Score
- Num 10 results
- Language All
Results 101 - 110 of 202 for item_id (0.04 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs_src/additional_responses/tutorial002_py310.py
class Item(BaseModel): id: str value: str app = FastAPI() @app.get( "/items/{item_id}", response_model=Item, responses={ 200: { "content": {"image/png": {}}, "description": "Return the JSON item or an image.", } }, ) async def read_item(item_id: str, img: bool | None = None): if img: return FileResponse("image.png", media_type="image/png")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 596 bytes - Click Count (0) -
docs/zh/docs/tutorial/path-params-numeric-validations.md
如果你使用的是更旧的版本,尝试使用 `Annotated` 会报错。 请确保在使用 `Annotated` 之前,将 FastAPI 版本[升级](../deployment/versions.md#upgrading-the-fastapi-versions)到至少 0.95.1。 /// ## 声明元数据 { #declare-metadata } 你可以声明与 `Query` 相同的所有参数。 例如,要为路径参数 `item_id` 声明 `title` 元数据值,你可以这样写: {* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[10] *} /// note | 注意 路径参数总是必需的,因为它必须是路径的一部分。即使你将其声明为 `None` 或设置了默认值,也不会产生任何影响,它依然始终是必需参数。 ///Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 6K bytes - Click Count (0) -
docs_src/custom_response/tutorial001b_py310.py
from fastapi import FastAPI from fastapi.responses import ORJSONResponse app = FastAPI() @app.get("/items/", response_class=ORJSONResponse) async def read_items():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 215 bytes - Click Count (0) -
docs/zh-hant/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`。 /// checkCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 8.4K bytes - Click Count (0) -
docs_src/path_operation_advanced_configuration/tutorial003_py310.py
from fastapi import FastAPI app = FastAPI() @app.get("/items/", include_in_schema=False) async def read_items():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 148 bytes - Click Count (0) -
docs/ja/docs/tutorial/path-params-numeric-validations.md
`Annotated`を使用する前に、FastAPI のバージョンを少なくとも 0.95.1 まで[アップグレードしてください](../deployment/versions.md#upgrading-the-fastapi-versions)。 /// ## メタデータの宣言 { #declare-metadata } パラメータは`Query`と同じものを宣言することができます。 例えば、パスパラメータ`item_id`に対して`title`のメタデータを宣言するには以下のようにします: {* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[10] *} /// note | 備考 パスパラメータはパスの一部でなければならないので、常に必須です。`None`で宣言したりデフォルト値を設定したりしても何も影響せず、常に必須のままです。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 7.6K bytes - Click Count (0) -
docs_src/path_operation_advanced_configuration/tutorial002_py310.py
from fastapi import FastAPI from fastapi.routing import APIRoute app = FastAPI() @app.get("/items/") async def read_items(): return [{"item_id": "Foo"}] def use_route_names_as_operation_ids(app: FastAPI) -> None: """ Simplify operation IDs so that generated API clients have simpler function names. Should be called only after all routes have been added. """ for route in app.routes:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 572 bytes - Click Count (0) -
docs/en/docs/tutorial/handling-errors.md
### The resulting response { #the-resulting-response } If the client requests `http://example.com/items/foo` (an `item_id` `"foo"`), that client will receive an HTTP status code of 200, and a JSON response of: ```JSON { "item": "The Foo Wrestlers" } ``` But if the client requests `http://example.com/items/bar` (a non-existent `item_id` `"bar"`), that client will receive an HTTP status code of 404 (the "not found" error), and a JSON response of:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 8.9K bytes - Click Count (0) -
docs_src/path_operation_configuration/tutorial006_py310.py
@app.get("/users/", tags=["users"]) async def read_users(): return [{"username": "johndoe"}] @app.get("/elements/", tags=["items"], deprecated=True) async def read_elements():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 365 bytes - Click Count (0) -
fastapi/.agents/skills/fastapi/SKILL.md
app = FastAPI() @app.get("/items/{item_id}") async def read_item( item_id: Annotated[int, Path(ge=1, description="The item ID")], q: Annotated[str | None, Query(max_length=50)] = None, ): return {"message": "Hello World"} ``` instead of: ```python # DO NOT DO THIS @app.get("/items/{item_id}") async def read_item( item_id: int = Path(ge=1, description="The item ID"),
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 10:05:57 GMT 2026 - 10.1K bytes - Click Count (0)