]> git.proxmox.com Git - ceph.git/blob - ceph/examples/boto3/list_unordered.py
import ceph 15.2.14
[ceph.git] / ceph / examples / boto3 / list_unordered.py
1 #!/usr/bin/python
2
3 import boto3
4 import sys
5
6 if len(sys.argv) != 2:
7 print('Usage: ' + sys.argv[0] + ' <bucket>')
8 sys.exit(1)
9
10 # bucket name as first argument
11 bucketname = sys.argv[1]
12
13 # endpoint and keys from vstart
14 endpoint = 'http://127.0.0.1:8000'
15 access_key='0555b35654ad1656d804'
16 secret_key='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
17
18 client = boto3.client('s3',
19 endpoint_url=endpoint,
20 aws_access_key_id=access_key,
21 aws_secret_access_key=secret_key)
22
23 # geting an unordered list of objets is an extension to AWS S3 API
24
25 print(client.list_objects(Bucket=bucketname, AllowUnordered=True))