I want to return .txt with some results to user by particular route. so i have:
@route('/export')
def export_results():
#here is some data gathering ot the variable
return #here i want to somehow return on-the-fly my variable as a .txt file
So, I know how to:
- open, return static_file(root='blahroot',filename='blah'), close, unlink
- make some similar actions with 'import tempfile' and so on
BUT: I heard that i can somehow set response http headers in some particular way, that returning my variable as a text will be got by browsers like a file.
the question is: how to make it run this way?
P.S.: as shown in tags I am on Python3, using Bottle and plan to have server from cherrypy as wsgi server