Skip to content Skip to sidebar Skip to footer

Get Kwargs Passed To Url_for In Flask View

I am passing some kwargs to url_for, but **kwargs in the view function isn't getting them. How do I get the extra data? File admin.py @admin_bp.route('/alerts', methods=['GET']) d

Solution 1:

You're looking for request.args. Any unknown keywords arguments passed to url_for will be used to populate the query string. The query string is then exposed through request.args.

@admin_bp.route('/alerts')
@admin_auth
def display_alerts():
    print(request.args)

Post a Comment for "Get Kwargs Passed To Url_for In Flask View"