deliverable_files.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:do-portal 作者: certeu 项目源码 文件源码
def download_file(file_id):
    """Download file

    **Example request**:

    .. sourcecode:: http

       GET /api/1.0/files/1 HTTP/1.1
       Host: do.cert.europa.eu
       Accept: application/json

    **Example response**:

    .. sourcecode:: http

       HTTP/1.0 200 OK
       Content-Type: application/json
       Content-Disposition: attachment; filename=CIMBL-244-EU.zip
       Content-Length: 55277
       Content-Type: application/zip


    :param file_id: file's unique ID

    :reqheader Accept: Content type(s) accepted by the client
    :resheader Content-Type: this depends on `Accept` header or request

    :status 200: File found
    :status 404: Resource not found
    """
    dfile = DeliverableFile.query.filter_by(id=file_id).first_or_404()
    cfg = current_app.config
    return send_file(os.path.join(cfg['APP_UPLOADS'], dfile.name),
                     attachment_filename=dfile.name, as_attachment=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号