]> git.proxmox.com Git - ceph.git/blame - ceph/examples/boto3/list_unordered.py
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / examples / boto3 / list_unordered.py
CommitLineData
9f95a23c
TL
1#!/usr/bin/python
2
3import boto3
4import sys
5
6if len(sys.argv) != 2:
f67539c2 7 print('Usage: ' + sys.argv[0] + ' <bucket>')
9f95a23c
TL
8 sys.exit(1)
9
10# bucket name as first argument
11bucketname = sys.argv[1]
12
13# endpoint and keys from vstart
14endpoint = 'http://127.0.0.1:8000'
15access_key='0555b35654ad1656d804'
16secret_key='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=='
17
18client = 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
f67539c2 25print(client.list_objects(Bucket=bucketname, AllowUnordered=True))