Guest User

Untitled

a guest
Jun 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. from boto.s3.connection import S3Connection
  2.  
  3.  
  4. file_to_upload = "e434b232c2e4f70aa2819d708dfd30fb4cebcf6c.zip"
  5.  
  6. s3 = S3Connection(YOUR_AWS_ACCESS_KEY, YOUR_AWS_SECRET_KEY)
  7. bucket = s3.get_bucket(YOUR_BUCKET_NAME)
  8.  
  9. # user will receive "mixtape.zip" instead of "e434b232c2e4f70aa2819d708dfd30fb4cebcf6c.zip"
  10. s3_headers = {'Content-Disposition': "attachment; filename=mixtape.zip"}
  11.  
  12. mt_key = bucket.new_key(file_to_upload)
  13. mt_key.set_contents_from_filename(/path/to/file_to_upload,
  14. headers=s3_headers)
Add Comment
Please, Sign In to add comment