flask 参数校验

校验参数是否存在,不存在返回400

@app.route('/check',methods=['POST'])
def check():
    values = request.get_json()
    required = ['a','b','c']
    if not all(k in values for k in required):
        return "Missing values",400

  

原文地址:https://www.cnblogs.com/shining5/p/12124744.html