This question already has an answer here:
- How to get data received in Flask request 15 answers
I'm wondering how to go about obtaining the value of a POST/GET request variable using Python with Flask.
With Ruby, I'd do something like this:
variable_name = params["FormFieldValue"]
How would I do this with Flask?
Adding more to Jason's more generalized way of retrieving the POST data or GET data
You can get posted form data from
request.form
and query string data fromrequest.args
.If you want to retrieve POST data,
If you want to retrieve GET (query string) data,
Or if you don't care/know whether the value is in the query string or in the post data,
request.values is a CombinedMultiDict that combines Dicts from request.form and request.args.