- Sort Score
- Num 10 results
- Language All
Results 711 - 720 of 1,032 for DEF (0.01 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs/ja/docs/index.md
app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: str = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>または<code>async def</code>を使います...</summary> `async` / `await`を使用するときは、 `async def`を使います: ```Python hl_lines="7 12" from fastapi import FastAPI
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Oct 11 17:48:49 GMT 2025 - 21.3K bytes - Click Count (0) -
docs_src/python_types/tutorial006_py39.py
def process_items(items: list[str]): for item in items:
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 80 bytes - Click Count (0) -
tests/test_tutorial/test_custom_response/test_tutorial009b.py
from pathlib import Path from fastapi.testclient import TestClient from docs_src.custom_response import tutorial009b_py39 from docs_src.custom_response.tutorial009b_py39 import app client = TestClient(app) def test_get(tmp_path: Path): file_path: Path = tmp_path / "large-video-file.mp4" tutorial009b_py39.some_file_path = str(file_path) test_content = b"Fake video bytes" file_path.write_bytes(test_content)
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 505 bytes - Click Count (0) -
docs_src/additional_responses/tutorial002_py39.py
"/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: Union[bool, None] = None): if img: return FileResponse("image.png", media_type="image/png") else:Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 628 bytes - Click Count (0) -
docs_src/schema_extra_example/tutorial004_an_py310.py
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Jul 01 16:43:29 GMT 2023 - 917 bytes - Click Count (0) -
docs_src/query_param_models/tutorial001_an_py310.py
limit: int = Field(100, gt=0, le=100) offset: int = Field(0, ge=0) order_by: Literal["created_at", "updated_at"] = "created_at" tags: list[str] = [] @app.get("/items/") async def read_items(filter_query: Annotated[FilterParams, Query()]):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 443 bytes - Click Count (0) -
docs_src/query_params_str_validations/tutorial008_py310.py
from fastapi import FastAPI, Query app = FastAPI() @app.get("/items/") async def read_items( q: str | None = Query( default=None, title="Query string", description="Query string for the items to search in the database that have a good match", min_length=3, ), ): results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]} if q: results.update({"q": q})
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Oct 24 20:26:06 GMT 2023 - 434 bytes - Click Count (0) -
docs/zh/docs/advanced/events.md
你可以跳过这一部分。 /// 有一种替代方法可以定义在**启动**和**关闭**期间执行的逻辑。 **FastAPI** 支持定义在应用启动前,或应用关闭时执行的事件处理器(函数)。 事件函数既可以声明为异步函数(`async def`),也可以声明为普通函数(`def`)。 ### `startup` 事件 使用 `startup` 事件声明 `app` 启动前运行的函数: {* ../../docs_src/events/tutorial001.py hl[8] *} 本例中,`startup` 事件处理器函数为项目数据库(只是**字典**)提供了一些初始值。 **FastAPI** 支持多个事件处理器函数。Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Oct 11 17:48:49 GMT 2025 - 7K bytes - Click Count (0) -
docs_src/schema_extra_example/tutorial001_py310.py
"description": "A very nice Item", "price": 35.4, "tax": 3.2, } ] } } @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 Jul 07 17:12:13 GMT 2023 - 646 bytes - Click Count (0) -
docs_src/bigger_applications/app_py39/main.py
app.include_router( admin.router, prefix="/admin", tags=["admin"], dependencies=[Depends(get_token_header)], responses={418: {"description": "I'm a teapot"}}, ) @app.get("/") async def root():
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 552 bytes - Click Count (0)