Last active
November 8, 2018 12:58
-
-
Save satendrakumar/8c8b16f4ec60618d98a18dd20d406f2a to your computer and use it in GitHub Desktop.
Upload and download from/to S3 using boto3 Api
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 | |
s3 = boto3.resource('s3') | |
def download(bucket_name, key, filePath): | |
try: | |
s3.meta.client.download_file(bucket_name, key, filePath) | |
except ValueError as err: | |
print('Error:', err) | |
def upload(filePath, bucket_name, key): | |
try: | |
s3.meta.client.upload_file(filePath, bucket_name, key) | |
except ValueError as err: | |
print('Error:', err) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment