Link to force download of external image with Python web app

305 views Asked by At

I've got a Python (Wep2py) web app that generates QR codes using the Google chart API. The app displays the QR code on the screen, and I want to offer a link to download it. Considering the images are not on my server, what are my options?

Example image url:
https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=Hello%20world

EDIT:

I've seen mention of using the header Content-disposition: attachment; to force a download dialog. Does anyone know if this header can be applied to external resources?

1

There are 1 answers

3
AudioBubble On
<a href="https://chart......world">Download QR code here</a>

Edit: If the browser of your user is able to handle the mimetype Google sends for the image, the browser will handle it. There is not much you can do about this which is a Good ThingTM.