Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from boto.s3.connection import S3Connection
- file_to_upload = "e434b232c2e4f70aa2819d708dfd30fb4cebcf6c.zip"
- s3 = S3Connection(YOUR_AWS_ACCESS_KEY, YOUR_AWS_SECRET_KEY)
- bucket = s3.get_bucket(YOUR_BUCKET_NAME)
- # user will receive "mixtape.zip" instead of "e434b232c2e4f70aa2819d708dfd30fb4cebcf6c.zip"
- s3_headers = {'Content-Disposition': "attachment; filename=mixtape.zip"}
- mt_key = bucket.new_key(file_to_upload)
- mt_key.set_contents_from_filename(/path/to/file_to_upload,
- headers=s3_headers)
Add Comment
Please, Sign In to add comment