I want to be able to get the data sent to my Flask app.
(我希望能够将数据发送到我的Flask应用。)
I've tried accessing request.data
but it is an empty string. (我尝试访问request.data
但是它是一个空字符串。)
How do you access request data? (您如何访问请求数据?)
@app.route('/', methods=['GET', 'POST'])
def parse_request():
data = request.data # data is empty
# need posted data here
The answer to this question led me to ask Get raw POST body in Python Flask regardless of Content-Type header next, which is about getting the raw data rather than the parsed data.
(这个问题的答案使我提出了在Python Flask中获取原始POST正文的问题,而不管接下来的Content-Type标头如何 ,这都是关于获取原始数据而不是已解析数据的。)
ask by ddinchev translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…