How to pass GET parameters to url using Flask Request [duplicate] How to pass GET parameters to url using Flask Request [duplicate] flask flask

How to pass GET parameters to url using Flask Request [duplicate]


Per the documentation I have found the answer (@E.Serra for impetus in the right direction):

flask.url_for(endpoint, **values)

Generates a URL to the given endpoint with the method provided.

Variable arguments that are unknown to the target endpoint are appended to the generated URL as query arguments. If the value of a query argument is None, the whole pair is skipped. In case blueprints are active you can shortcut references to the same blueprint by prefixing the local endpoint with a dot (.).

So if you have the route

@app.route('/view/<variable>/')def view(variable):    pass

The call

url_for('view', variable='parameter', variable2='parameter2')

will produce a url where parameter2 is a query argument.