-
-
Save abdul/5524376 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
from boto.s3.connection import S3Connection | |
AWS_ACCESS_KEY = '<aws access key>' | |
AWS_SECRET_KEY = '<aws secret key>' | |
AWS_BUCKET_NAME = '<aws bucket name>' | |
AWS_HEADERS = { | |
'Cache-Control':'max-age=31556926,public' | |
} | |
AWS_ACL = 'public-read' | |
conn = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KEY) | |
bucket = conn.get_bucket(AWS_BUCKET_NAME) | |
bucket.make_public() | |
for key in bucket.list(): | |
print key.name | |
key.set_contents_from_string(None, headers=AWS_HEADERS, replace=False, policy=AWS_ACL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment