0 votes
in Python Flask by
How to get query String in Flask?

1 Answer

0 votes
by
We can get the argument’s value using the request object in Flask.

An example is shown below.

from flask import Flask

from flask import request

 

app = Flask(__name__)

 

@app.route("/")

def index():

val = request.args.get("var")

 

return "Hello, World! {}".format(val)

 

if __name__=="__main__":

app.run(host="0.0.0.0", port=8080)

When we use the browser to navigate with a request parameter, then we see the below result.

request parameter - result

Related questions

0 votes
asked Dec 24, 2022 in Python Flask by sharadyadav1986
0 votes
asked Dec 23, 2022 in Python Flask by john ganales
...