Flask 3 · Routes and requests
Capture part of the URL
Convert the value to an integer with a converter.
@app.get("/users/<int:user_id>")
def show_user(user_id):
return f"User {user_id}"
Official Flask 3 documentation
Flask 3 · Routes and requests
Convert the value to an integer with a converter.
@app.get("/users/<int:user_id>")
def show_user(user_id):
return f"User {user_id}"
Official Flask 3 documentation
Was this page helpful?