Created
September 23, 2018 23:48
-
-
Save nmolivo/68af26a2dea66aa9b02c4ec739b9075f to your computer and use it in GitHub Desktop.
This file contains 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
# programmatically edit metadata of s3 bucket files, so the links open in a browser tab and do not download | |
# to your computer when clicked | |
client = boto3.client('s3', aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY) | |
for i in html_list: | |
key = i | |
k = client.head_object(Bucket = bucket_name, Key = key) | |
client.copy_object(Bucket = bucket_name, Key = key, CopySource = bucket + '/' + key, ContentType ='text/html', MetadataDirective='REPLACE') | |
client = boto3.client('s3', aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY) | |
for i in pdf_list: | |
key = i | |
k = client.head_object(Bucket = bucket_name, Key = key) | |
client.copy_object(Bucket = bucket_name, Key = key, CopySource = bucket + '/' + key, ContentType ='application/pdf', ContentDisposition = 'inline', MetadataDirective='REPLACE') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment