Version:
When using Python, please try using virtualenv. Managing the library will be much easier.
from boto.s3.key import Key
from boto.s3.connection import S3Connection
#access code
AWS_SECRET_ACCESS_KEY = ''
AWS_ACCESS_KEY_ID = ''
bucket_name = ''
key_name = ''
conn = S3Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket = conn.create_bucket(bucket_name)
k = Key(bucket)
#Upload
#file_name is upro-The name of the file in the directory you want to
k.key = key_name
k.set_contents_from_filename(file_name)
#Download
k.get_contents_to_filename(file_name)
Recommended Posts