How do you access query parameters or the query string in Flask routes? It's not obvious from the Flask documentation.
The example route /data
below illustrates the context that I would like to access that data. If someone requests something like example.com/data?abc=123
, I would like access to the string ?abc=123
or to be able to retrieve the value of parameters like abc
.
@app.route("/data")
def data():
# query_string = ???
return render_template("data.html")
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…