使用Python和Amazon S3下载文件的进度条

时间:2018-11-20 05:30:28

标签: python-2.7 amazon-web-services amazon-s3 progress-bar boto3

下面的代码使用python2.7从AWS S3存储桶下载文件。我想显示一个进度条。

#! usr/bin/python

import boto3
import botocore

file1 = open("aws.txt","r")
r1 = file1.read()
length = len(r1)-1
file1.close()
file2 = open("aws.txt","r")
r2 = file2.read(length)
file2.close

 s3 = boto3.resource('s3')
try:
    s3.Bucket('gustotest2').download_file(r2,r2)
except botocore.exception.ClientErrors as e:
    if e.response['Error']['Code'] == '404':
        print('The update file does not exist')
    else:
        raise

有人可以为此建议我一个解决方案吗? 预先感谢!

0 个答案:

没有答案