Created
May 23, 2020 17:40
-
-
Save Allwin12/b04d6e73eef18f278cbc4a8aa58d4fda 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
from boto3 import Session | |
import string | |
import random | |
ACCESS_KEY = "your access key" | |
SECRET_KEY = "your_secret_key" | |
REGION_NAME = "your bucket's region name" | |
BUCKET_NAME = "your bucket name" | |
ses = Session(aws_access_key_id=ACCESS_KEY, | |
aws_secret_access_key=SECRET_KEY, | |
region_name=REGION_NAME) | |
key = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(10)) | |
s3 = ses.client('s3') | |
url = s3.generate_presigned_post(Bucket=BUCKET_NAME, Key=key, ExpiresIn=3600) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment