Amazon S3 Aws - get_bucket method in boto python API
This example shows how to get a single key from a bucket and then write that key to a file.
post this code
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
If you want to be updated about similar snippets,
and follow our Channels