Created
June 15, 2015 04:32
-
-
Save arthuralvim/3fb534a8e470f4e4d5a7 to your computer and use it in GitHub Desktop.
Working with files in AWS S3
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
from boto.s3.connection import S3Connection | |
from boto.s3.key import Key | |
# Get connection using Amazon secret and access keys | |
conn = S3Connection('<aws secret key>', '<aws access key>') | |
# Get the bucket with name 'bucketname' | |
bucket = conn.get_bucket('bucketname') | |
# Get the key reference to file 'picture.jpg' | |
key = bucket.get_key("picture.jpg") | |
# Open file in write mode | |
fp = open ("picture.jpg", "w") | |
# Set the reference to file | |
key.get_file (fp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment