choldgraf / nbreport

27 stars 4 forks source link

Trigger download #2

Open betatim opened 5 years ago

betatim commented 5 years ago

Currently the generated report is written to the filesystem instead of popping up a download window.

In https://github.com/gedankenstuecke/jupyter-bundler-openhumans @gedankenstuecke made a new bundle for sharing a notebook. Maybe he has a good idea for how to trigger the download.

choldgraf commented 5 years ago

maybe it's this line:

https://github.com/gedankenstuecke/jupyter-bundler-openhumans/blob/master/oh_bundler/__init__.py#L55

where he triggers a redirect?

gedankenstuecke commented 5 years ago

Can I get an overview of what exactly the goal is? So a report is generated and instead of displaying the link like shown in the README you want to automatically trigger the download?

In my case the redirect heads over to the exploratory.openhumans.org page where you then have to fill in the meta data. But I think you could just replace that redirect to link to your written report and set the Content-Disposition header to force the download?

betatim commented 5 years ago

Content-disposition is the key word I think.

gedankenstuecke commented 5 years ago

Yeah, as I'm no Tornado expert I'm not sure how you'd set it on the handler but that should hopefully be straight-forward 😄