flask post 错误数据 retrive throw postman form data

问题描述 投票:0回答:0
from flask import Flask,request,jsonify,json,jsonify
import numpy as np

app = Flask(__name__)


@app.route('/heartpredict',methods=['POST'])
def heartpredict():
    age = request.form.get('age')
    sex = request.form.get('sex')
    cp = request.form.get('cp')
    trestbps = request.form.get('trestbps')
    chol = request.form.get('chol')
    fbs = request.form.get('fbs')
    restecg = request.form.get('restecg')
    thalach = request.form.get('thalach')
    exang = request.form.get('exang')
    oldpeak = request.form.get('oldpeak')
    slope = request.form.get('slope')
    ca = request.form.get('ca')
    thal = request.form.get('thal')

    print(age,sex,cp,trestbps,chol,fbs,restecg,thalach,exang,oldpeak,slope,ca,thal)

    return "okk"

enter image description here enter image description here 我已经在邮递员中输入了键值表单数据并点击了 flask rest post 请求以打印或返回值 throw key 但它打印了空值所以请帮助我任何人取回原始值。 在 vs 代码控制台中看到打印所有无值。这是问题。

我想打印所有没有价值的原始价值。

flask postman flask-restful
© www.soinside.com 2019 - 2024. All rights reserved.