boto3有两种不同的方式访问AmazonS3
Client Method
import boto3
s3_client = boto3.client('s3')
objects = s3_client.list_objects('bucket-name')
for object in objects['Contents']:
print(object['Key'])
Resource Method
import boto3
s3_resource = boto3.resource('s3')
for object in s3_resource.Bucket('bucket-name').objects.all():
print(object.key)