mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-24 06:39:31 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
10 lines
230 B
Python
10 lines
230 B
Python
from fastapi import FastAPI, Request
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/items/{item_id}")
|
|
def read_root(item_id: str, request: Request):
|
|
client_host = request.client.host
|
|
return {"client_host": client_host, "item_id": item_id}
|