post请求python flask获取前端发来的参数有三种方式
from flask import request
# params拿请求
data = {}
for key in request.args:
data[key] = request.args.get(key)
file_type = data['file_type']
safety_check_command = data['safety_check_command']
remark = data['remark']
create_user = data['create_user']
weight = data['weight']
注意:不带附件,前端服务器express+pm2可能出现问题。
from flask import request
file_obj = request.files.get('excel')
DeploymentID = request.form['DeploymentID'] # 获取DeploymentID
environment = request.form['environment'] # 获取环境
project = request.form['project'] # 获取项目
from flask import request, json
data = request.get_data()
json_data = json.loads(data.decode("UTF-8"))
DeploymentID = json_data.get("DeploymentID")
Gitlab_URL = json_data.get("Gitlab_URL")
basics_URL = json_data.get("basics_URL")
--暂无评论--