📜  如何在烧瓶响应中返回图像? - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:00.740000             🧑  作者: Mango

代码示例1
from flask import send_file

@app.route('/get_image')
def get_image():
    if request.args.get('type') == '1':
       filename = 'ok.gif'
    else:
       filename = 'error.gif'
    return send_file(filename, mimetype='image/gif')