I am using a python script (API) to load some data to ajax data-table. Since I also need to export that data to a csv file, I created a custom button and on click of that button I am calling a function (in python script) which is exporting that data. Everything is working perfectly but, what i want is on click of custom export button, browser’s download dialog box prompts for download but python is auto downloading . My query is is there any method of frappe which i can use for this purpose or any python module which uses browser’s download feature to export the data
When i am hitting the url via browser, the download dialog box is prompting but when i am using the custom button, it is automatically downloading. Tried this in my response header
"Content-Type": "application/octet-stream" "Content-Disposition": "attachment; filename=file_name.csv" "Content-Transfer-Encoding": "bytes"
But doesn’t worked. Any help that what headers i should use in my python script and what in custom script’s ajax call