2016-02-15 11 views
5

próby ustawienia boto3 S3Transfer według AWS dokumentów:Canot wystąpienia boto3 klasy S3Transfer

import boto3 
client = boto3.client('s3', 'us-east-1') 
transfer = S3Transfer(client) 

Wynik:

NameError: name 'S3Transfer' is not defined 

Próbowano Pyton 2.7.11 i 3.5.1 (MacOS), taki sam rezultat . boto3 jest zainstalowany i poprawnie rozwiązany w moim 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 

Wszelkie wskazówki byłyby mile widziane.

Dzięki, Ron

Odpowiedz

9

Klasa S3Transfer jest w module boto3.s3.transfer więc trzeba zrobić coś takiego:

from boto3.s3.transfer import S3Transfer 
import boto3 

client = boto3.client('s3') 
transfer = S3Transfer(client) 

Uwaga oświadczenie import powyżej. Zauważ również, że metody S3Transfer są już zintegrowane z klientem S3 i zasobem S3, więc nie musisz mieć do niego bezpośredniego dostępu.