Tag Archives: flask

How to get data received in Flask request

from flask import request

For URL Query parameter, use request.args

search = request.args.get("search")
page = request.args.get("page")

For Form input, use request.form

email = request.form.get('email')
password = request.form.get('password')

For data type application/json, use request.data

# data in string format and you have to parse into dictionary
data = request.data
dataDict = json.loads(data)

References
https://stackoverflow.com/questions/10434599/how-to-get-data-received-in-flask-request