s3scrot_3.py 374 B

1234567
  1. def upload_to_s3(path, config):
  2. conn = S3Connection(config['s3']['access_key'], config['s3']['secret_key'])
  3. bucket = conn.get_bucket(config['s3']['bucket'])
  4. key = Key(bucket, str(uuid.uuid1())+"."+path.split(".")[-1])
  5. key.set_contents_from_filename(path)
  6. key.set_canned_acl('public-read')
  7. return key.generate_url(0, query_auth=False, force_http=True)