Created
February 24, 2015 14:15
-
-
Save bobbidigital/f12e1156cb3b728b72fb to your computer and use it in GitHub Desktop.
Generate a Signed URL that Expires (Python)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto | |
import boto.s3.connection | |
access_key = '' | |
secret_key = '' | |
conn = boto.connect_s3( | |
aws_access_key_id = access_key, | |
aws_secret_access_key = secret_key, | |
#is_secure=False, # uncomment if you are not using ssl | |
calling_format = boto.s3.connection.OrdinaryCallingFormat(), | |
) | |
bucket = conn.get_bucket('grubhub-example-bucket') | |
apk_file = bucket.get_key('/path/to/filename.txt') | |
# expires_in is epoch time | |
apk_file_url = apk_file.generate_url(expires_in=1738254231, expires_in_absolute=1, query_auth=True, force_http=True) | |
print apk_file_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment