Upload a file/image to AWS S3 bucket, meant for use with nostr for image hosting.
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 | |
def upload(file_name, bucket, aws_access_key, aws_access_key_sec): | |
s3 = boto3.client('s3', aws_access_key_id=aws_access_key, aws_secret_access_key=aws_access_key_sec) | |
s3.upload_file(file_name, bucket, file_name) | |
url = f"https://{bucket}.s3.amazonaws.com/{file_name}" | |
return url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment