主要是这样的1种需求,希望某个人对你编写的FlaskAPI接口提交数据时,你输入某个URL路由可以查看它提交过来的数据,而提交接口的对应的URL路由程序继续执行下去,不会将提交的数据输出。
这里假设我们有1个接口getUserList,现在人家对这个接口传递数据,而与此同时假设你打开路由地址为_debug,则可以看到传递到getUserList中的数据,而在getUserList接口不需要输出传递数据的内容。
PHPz2017-04-18 09:05:25
Storage it directly into the database when requested, and then read it when needed.
天蓬老师2017-04-18 09:05:25
Viewing customer data mainly depends on the variable flask.request.
The data is probably stored in request.data, which can be implemented like this.
from flask import Flask, request, current_app
app = Flask(__name__)
@app.route('/getUserList', methods=['GET', 'POST'])
def getUserList():
current_app.getUserList_data = request.data
return 'ok'
@app.route('/getUserList_debug', methods=['GET', 'POST'])
def getUserList_debug():
return current_app.getUserList_data
if __name__ == '__main__':
app.run(debug=True)