March 2019
Beginner
490 pages
12h 40m
English
To list buckets, we need to do a get request with the AWS authentication data. Then we get the response in XML format and get the response.text content:
>>> endpoint = 's3.eu-west-2.amazonaws.com'>>> auth = aws4auth.AWS4Auth(access_id, access_key, region, 's3')>>> response = requests.get("http://"+endpoint, auth=auth)>>> print(response.text)<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>e6c7c8b59da100190ebe74cf53f402506382c4c2889d64c426f8cfa8026e2f29</ID></Owner><Buckets><Bucket><Name>bucket-aux</Name><CreationDate>2018-12-11T18:33:03.000Z</CreationDate></Bucket><Bucket><Name>zappa-0esu8ehc9</Name><CreationDate>2018-07-23T11:19:50.000Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult> ...Read now
Unlock full access