试图根据AWS文档设置boto3 S3Transfer:
import boto3
client = boto3.client('s3', 'us-east-1')
transfer = S3Transfer(client)
结果:
NameError: name 'S3Transfer' is not defined
尝试了Python2.7.11和3.5.1 (MacOS),结果相同。boto3已在我的IDE (IntelliJ)中安装并正确解析:
Successfully installed boto3-1.2.3 botocore-1.3.26 docutils-0.12 futures-3.0.5 jmespath-0.9.0 python-dateutil-2.4.2
如有任何指示,将不胜感激。
谢谢你,罗恩
发布于 2016-02-15 14:19:11
S3Transfer
类位于模块boto3.s3.transfer
中,因此您必须执行如下操作:
from boto3.s3.transfer import S3Transfer
import boto3
client = boto3.client('s3')
transfer = S3Transfer(client)
注意上面的import语句。还请注意,S3Transfer方法已经集成到S3客户端和S3资源中,因此您可能不需要直接访问它。
https://stackoverflow.com/questions/35420047
复制相似问题