How do I create a download link for a file present in amazon S3 using python boto?
1 answer
When creating the URL, you must specify the "content disposition" response header:
headers = {'response-content-disposition': 'attachment; filename="your-filename.txt"'}
url = key.generate_url(expires_in=600, response_headers=headers)
When a URL is used , this will cause S3 to return a Content-Disposition Header , which tells the browser that it should download the file rather than display it directly.
0
source to share