Skip to content

Instantly share code, notes, and snippets.

@aloha1003
Created August 24, 2016 09:48
Show Gist options
  • Save aloha1003/bed8d78e1fa7652541cc4126196c8ccb to your computer and use it in GitHub Desktop.
Save aloha1003/bed8d78e1fa7652541cc4126196c8ccb to your computer and use it in GitHub Desktop.
def downLoadImage(region, imageObj):
s3 = boto3.resource('s3', region_name=region)
bucketName = str(imageObj["Bucket"])
objectName = str(imageObj["Object"])
key = s3.Bucket(bucketName) \
.Object(objectName)
saveFileName = '/tmp/'+objectName.replace('/', '__')
s3.meta.client.download_file(bucketName, objectName, saveFileName)
return saveFileName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment