python - How to change the name of .csv Response on Flask -
i'm using flask web service , in point have send report user. has on .csv format, i'm using code:
# ... def generate(): head 'some headers' # loops data lists , dbs yield 'the data' # ... return response(generate(), mimetype = 'text/csv')
the name of report 'someletters.csv' , user want name more descriptive, how can change name of report? looking on flask documentation , didn't find useful.
you can following in code:
filename_ = 'myfilename.csv' # or format like. return response(generate(), mimetype="text/csv", headers={"content disposition":"attachment; filename=" + filename_})
Comments
Post a Comment