First print something before sending a file to the user

10 views
Skip to first unread message

nikos.at....@gmail.com

unread,
Sep 26, 2018, 12:17:38 PM9/26/18
to bottlepy

As it is now the following code cannot return a tuple, with 2 elements, 1st one being a astring and then a response method.


@app.route( '/file', methods=['POST'] )
def file():

    pdata = ''
    pdata = pdata + '''<img src="/static/img/arrow.gif" align="left">'''
    return pdata, send_from_directory( filepath, filename, as_attachment=True )


What is the easiest way to have pdata print some lines before i return afile to the user?


I do NOT wish to create an extra html template just to print some lines.

Reply all
Reply to author
Forward
0 new messages