Created
July 6, 2020 12:40
-
-
Save uni-3/946f57e2bd59549ad2c3476a751ee62d to your computer and use it in GitHub Desktop.
download from s3
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
# codinf: utf-8 | |
import boto3 | |
from boto3.session import Session | |
BUCKET = 'bucket' | |
PATHS = ['data/test.csv'] | |
session = Session( | |
aws_access_key_id='', | |
aws_secret_access_key='', | |
) | |
s3 = session.resource('s3') | |
def main(bucket='', paths=[], output='./downloads.csv'): | |
bucket = s3.Bucket(bucket) | |
for path in paths: | |
print('download from: ', 's3://' + BUCKET + '/' + path) | |
bucket.download_file(path, output) | |
if __name__ == '__main__': | |
main(bucket=BUCKET, paths=PATHS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment