Created
December 20, 2013 01:08
-
-
Save ian-su-sirca/8048936 to your computer and use it in GitHub Desktop.
Upload api docs to S3
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 | |
| import boto.s3 | |
| from boto.s3.key import Key | |
| import os | |
| region = 'ap-southeast-2' | |
| bucket = 'docs.sense-t.sirca.org.au' | |
| folder = 'api' | |
| s3 = boto.s3.connect_to_region(region) | |
| b = s3.get_bucket(bucket) | |
| if b is None: | |
| print "No such bucket %s" % bucket | |
| for f in os.listdir('.'): | |
| if os.path.isfile(f) and (f.endswith('.html') or f.endswith('.css')): | |
| uf = "%s/%s" % (folder, f) | |
| print "Uploading to %s" % uf | |
| key = Key(b) | |
| key.key = uf | |
| key.set_contents_from_filename(f) | |
| key.set_acl('public-read') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment