- Sort Score
- Num 10 results
- Language All
Results 21 - 30 of 274 for head_item (0.09 seconds)
-
docs_src/handling_errors/tutorial004_py39.py
for error in exc.errors(): message += f"\nField: {error['loc']}, Error: {error['msg']}" return PlainTextResponse(message, status_code=400) @app.get("/items/{item_id}") async def read_item(item_id: int): if item_id == 3: raise HTTPException(status_code=418, detail="Nope! I don't like 3.")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 920 bytes - Click Count (0) -
docs_src/path_operation_advanced_configuration/tutorial002_py39.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 Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 572 bytes - Click Count (0) -
docs_src/additional_responses/tutorial002_py310.py
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") else:Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 596 bytes - Click Count (0) -
docs_src/query_params/tutorial001_py39.py
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 250 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/ko/docs/advanced/templates.md
``` ### 템플릿 `url_for` 인수 템플릿 내에서 `url_for()`를 사용할 수도 있으며, 이는 *경로 작업 함수*에서 사용될 인수와 동일한 인수를 받습니다. 따라서 다음과 같은 부분에서: {% raw %} ```jinja <a href="{{ url_for('read_item', id=id) }}"> ``` {% endraw %} ...이는 *경로 작업 함수* `read_item(id=id)`가 처리할 동일한 URL로 링크를 생성합니다. 예를 들어, ID가 `42`일 경우, 이는 다음과 같이 렌더링됩니다: ```html <a href="/items/42"> ``` ## 템플릿과 정적 파일Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Oct 11 17:48:49 GMT 2025 - 3.7K bytes - Click Count (0) -
docs_src/handling_errors/tutorial006_py39.py
async def validation_exception_handler(request, exc): print(f"OMG! The client sent invalid data!: {exc}") return await request_validation_exception_handler(request, exc) @app.get("/items/{item_id}") async def read_item(item_id: int): if item_id == 3: raise HTTPException(status_code=418, detail="Nope! I don't like 3.")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 928 bytes - Click Count (0) -
docs/pt/docs/advanced/templates.md
Logo, a seção com: {% raw %} ```jinja <a href="{{ url_for('read_item', id=id) }}"> ``` {% endraw %} ...irá gerar um link para a mesma URL que será tratada pela *path operation function* `read_item(id=id)`. Por exemplo, com um ID de `42`, isso renderizará: ```html <a href="/items/42"> ```Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 3.6K bytes - Click Count (0) -
docs_src/query_params/tutorial003_py39.py
from typing import Union from fastapi import FastAPI app = FastAPI() @app.get("/items/{item_id}") async def read_item(item_id: str, q: Union[str, None] = None, short: bool = False): item = {"item_id": item_id} if q: item.update({"q": q}) if not short: item.update( {"description": "This is an amazing item that has a long description"} )
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 406 bytes - Click Count (0) -
docs_src/templates/tutorial001_py39.py
app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") @app.get("/items/{id}", response_class=HTMLResponse) async def read_item(request: Request, id: str): return templates.TemplateResponse( request=request, name="item.html", context={"id": id}
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 521 bytes - Click Count (0)