Skip to content

Instantly share code, notes, and snippets.

@zbyte64
Last active December 14, 2015 23:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbyte64/5163791 to your computer and use it in GitHub Desktop.
Save zbyte64/5163791 to your computer and use it in GitHub Desktop.
Fix cross origins on S3 with boto
from boto.s3.cors import CORSConfiguration
from boto.s3.connection import S3Connection
conn = S3Connection('<aws access key>', '<aws secret key>')
bucket = conn.create_bucket('mybucket')
config = CORSConfiguration()
config.add_rule(allowed_method=['GET'], allowed_origin=['*'], allowed_header=['Content-*', 'Host'], max_age_seconds=3000)
bucket.set_cors(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment