Python rest api - download Csv

15 Views Asked by At

I am trying to build python rest api which allows to download result in csv file.

class Result:
def on_get(self, req, resp):
   resp.content_type = 'text/csv'
   resp.downloadable_as = 'somefile.csv'
   resp.text = output.getvalue()

Url -> localhost:8000/download works fine.

Issue-> User need to open the url in new windows and reload the page to download the csv file, when url in posted in some other application webpage.

Can this be avoided. Will prefer if download happens as soon some user click on url .

FYi-> I am using falcon.

0

There are 0 best solutions below