
fastapi
programming
python
FastAPI Parameters
0 min read (38 words)
A quick note about how to pass parameters
@app.get("/ise/{mac_address}")
async def ise_search_mac_address(mac_address):
return {"Search MAC": mac_address}

Another example:
@app.get("/{mode}/ise")
async def ise_mode(mode):
if mode == 'dev':
return {'result': "Working with Dev ISE"}
return {'result': "Working with Prod ISE"}


About
Dmitry Golovach
Principal Network Engineer and AI enthusiast. Always learning, always building.