Created
August 30, 2019 00:28
-
-
Save jworl/148754e3fe1ad76232173d8582595abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
access_key = "YOURACCESSKEYHERE" | |
secret_key = "YOURSECRETKEYHERE" | |
bucket = "YOURBUCKETNAMEHERE" | |
filename = "YOURFILENAME.ova" | |
full_path = "/path/to/your/file/" | |
conn = boto3.client('s3', 'us-east-1', | |
endpoint_url="http://ceph-s3.services.dmtio.net", | |
aws_access_key_id = access_key, | |
aws_secret_access_key = secret_key) | |
#This will create a new bucket for you | |
conn.create_bucket(Bucket=bucket) | |
#This will upload the file to your newly created bucket | |
conn.upload_file('{}{}'.format(full_path, filename), bucket, filename) | |
#This will generate a URL for us to download within 24 hours | |
download_url = conn.generate_presigned_url('get_object', Params = {'Bucket': bucket, 'Key': filename}, ExpiresIn = 28800) | |
#copy this address and send it to me | |
print(download_url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment