· 7 years ago · Oct 31, 2018, 05:32 PM
1from boto.s3.connection import S3Connection
2
3def sign(bucket, path, access_key, secret_key, https, expiry):
4 c = S3Connection(access_key, secret_key)
5 return c.generate_url(
6 expires_in=long(expiry),
7 method='GET',
8 bucket=bucket,
9 key=path,
10 query_auth=True,
11 force_http=(not https)
12 )