REST API-发送不带标题的PDF文件和其他信息

时间:2019-07-11 10:19:10

标签: rest api flask flask-restful

我需要使用flask-restful将文件和其他信息从API发送到前端。

目前我正在做

    file = send_file(
        io.BytesIO(file_bytes_tot),
        attachment_filename="file.pdf",
        mimetype="application/pdf",
        as_attachment=True,
    )
    file.headers["File-Storage"] = storage
    file.headers["File-Location"] = file_path
    return file

但是我不应该为此使用标题。还有另一种方法吗?

理想情况-具有字段文件(字节)和文件存储文件位置-字符串

的JSON消息

0 个答案:

没有答案
相关问题