Skip to content

Instantly share code, notes, and snippets.

@AJLeonardi
Created April 18, 2018 12:19
Show Gist options
  • Save AJLeonardi/ea2a79223c10728dc1172d7c3ed1a198 to your computer and use it in GitHub Desktop.
Save AJLeonardi/ea2a79223c10728dc1172d7c3ed1a198 to your computer and use it in GitHub Desktop.
DreamObjects boto3 CORS config for fonts
import boto3
session = boto3.session.Session()
connection = session.resource(
's3',
aws_access_key_id= '...', #dreamObjects key
aws_secret_access_key= '...', #dreamObjects secret key
endpoint_url= 'https://objects-us-west-1.dream.io',
)
client = connection.meta.client
cors_configuration = {
'CORSRules': [
{
'AllowedHeaders': ['Content','Host'],
'AllowedMethods': ['GET', 'HEAD'],
'AllowedOrigins': ['https://www.?.com', 'https://?.com', 'http://www.?.com', 'http://?.com'],
'ExposeHeaders': ['ETag'],
'MaxAgeSeconds': 86400
}
]
}
#my-bucket-name is the name of an existing bucket
client.put_bucket_cors(Bucket='my-bucket-name', CORSConfiguration=cors_configuration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment