python flask 获取 get post 参数
python flask 获取 get post 参数
from flask import Flask, jsonify
from flask import request
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def hello_world():
print('请求方式为------->', request.method)
args = request.args.get("name") # 获取 get 参数
form = request.form.get('data') # 获取 post 参数
# main(form) # 调用我们的逻辑函数
get_html(form)
print("=========成功 生成 index.html================")
return jsonify(args=args, form=form)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5800, debug=True)
参考 https://blog.csdn.net/whatday/article/details/109808826?