美文网首页
python使用flask获取post请求

python使用flask获取post请求

作者: zerowl | 来源:发表于2019-04-09 17:06 被阅读0次
from flask import request, Flask, jsonify

app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False


@app.route('/test', methods=['POST'])
def post_Data():
    print('hh')
    postdata = request.form['id']
    file = request.files['file']
    recognize_info = {'id': postdata, 'info': '收到'+file.filename}
    return jsonify(recognize_info), 201


if __name__ == '__main__':
    app.run(debug=False, host='0.0.0.0', port=8888)

用postman测试结果如下


1.png

相关文章

网友评论

      本文标题:python使用flask获取post请求

      本文链接:https://www.haomeiwen.com/subject/goriiqtx.html