Skip to content

Instantly share code, notes, and snippets.

@spulec
Last active December 20, 2015 03:09
Show Gist options
  • Save spulec/6062057 to your computer and use it in GitHub Desktop.
Save spulec/6062057 to your computer and use it in GitHub Desktop.
import boto
conn = boto.connect_s3()
bucket = conn.get_bucket("{{ bucket }}")
key = bucket.new_key("{{ filename }}")
key.set_contents_from_filename("{{ filename }}")
url = key.generate_url({% if expires %}{{ expires }}{% else %}3600{% endif %})
print url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment