Flask - pass variable from URL to function
I see two options:
a) You add a variable part to your URL. Something like that:
@planck.route("/admin/assign_ticket/<int:ticket_id>")def assign_to(ticket_id): some_work()
I think this is a more Flask way to approach this issue, but it will require different url from the one mentioned in the question. Instead it will be like: http://planck:5000/admin/assign_ticket/12
b) Just:
from flask import request
And request.args is a dict with your url query parameters.
from flask import request@planck.route("/admin/assign_ticket")def assign_to(): ticket_id = request.args.get('ticket_id') some_work()
Be careful to properly handle case when such parameter is not passed.