Created
August 14, 2023 16:07
-
-
Save wthorp/7a6ba6b037efea3949322be1121f0d4e 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 = "..." | |
SECRET_KEY = "..." | |
BUCKET_NAME = "..." | |
PATH_WITHIN_BUCKET = "example/path" | |
EXPIRES = 3600 # seconds | |
URL = "https://gateway.storjshare.io" | |
session = boto3.session.Session() | |
s3 = session.client(service_name="s3", aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY, endpoint_url=URL) | |
url = s3.generate_presigned_url('put_object', Params={"Bucket":BUCKET_NAME, "Key":PATH_WITHIN_BUCKET}, ExpiresIn=EXPIRES) | |
print(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment