Created
August 14, 2023 16:06
-
-
Save wthorp/b6239e521fe3f82ce4dd3a308192c067 to your computer and use it in GitHub Desktop.
Presigned GET Python
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('get_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