disabling character escaping in Flask's url_for function disabling character escaping in Flask's url_for function flask flask

disabling character escaping in Flask's url_for function


url_for does not support your use case, but assuming you are using it inside a Jinja template you could just add a call to replace to remove the encoding:

{{ url_for('get_user', user_id='%') | replace('%25', '%') }}

Alternatively, if you passing the URL around in normal Python code you could use urllib.parse.unquote (or urllib.unquote if you are still on Python 2):

url = url_for('get_user', 'user_id'='%')url = unquote(url)