/
Boto3

Boto3

Below example of how to list all containers and files in Swift using Boto3 and the S3 API. See S3 - Boto3 1.36.24 documentation for more information on how to use Boto3.

Replace aws_access_key_id and aws_secret_access_key with your S3 API keys

#!/usr/bin/env python import boto3 if __name__ == "__main__": session = boto3.Session( aws_access_key_id='AAABBBCCC111222333', aws_secret_access_key='333222111CCCBBBAAA') s3 = session.client('s3', endpoint_url='https://object.cloud.sdsc.edu') buckets = s3.list_buckets() for bucket in buckets['Buckets']: print(bucket['Name']) print('=======================') paginator = s3.get_paginator('list_objects_v2') pages = paginator.paginate(Bucket=bucket['Name']) for page in pages: if 'Contents' in page: for object in page['Contents']: print(object['Key'])

Related content

Generating S3 API Keys
Generating S3 API Keys
More like this
Boto2
More like this
s3cmd
More like this
Boto 3
More like this
Cyberduck GUI
Cyberduck GUI
More like this
S3 API
More like this