Question

I have a python script running inside the Google App Engine with boto 1.9b that gets all keys inside a S3-Bucket. The output is formated as a HTML-Table.

bucket_instance = conn_s3.get_bucket(bucketname)
liste_keys = bucket_instance.get_all_keys()

table = '<table>'
for i in range(laenge_liste_keys):
  table = table + '<tr><td>'+str(liste_keys[i].name)+</td></tr>'
table = '</table>'

How can I realize the key-names as links that enable the user to download the key via the browser?

Thanks in advance!

Was it helpful?

Solution

The solution is found.

generate_url(expires_in, method='GET', headers=None, query_auth=True, force_http=False)

This makes it easy to create a link for every key which is valid for x seconds.

OTHER TIPS

The public URL for the file would be something like:

http://s3.amazonaws.com/bucket_name/key_name  

So in your code, add links with their href attributes pointing to that URL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top