Skip to content

Instantly share code, notes, and snippets.

@Allwin12 Allwin12/download.py
Created May 23, 2020

Embed
What would you like to do?
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 = "The same key that we used for upload"
filename = 'download.pdf'
s3 = ses.resource('s3')
s3.Bucket(BUCKET_NAME).download_file(key, filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.