Asyncio-based client for S3
The aio-s3 is a small library for accessing Amazon S3 Service that leverages python’s standard asyncio library.
Only read operations are supported so far, contributions are welcome.
Basically all methods supported so far are shown in this example:
import asyncio from aios3.bucket import Bucket @asyncio.coroutine def main(): bucket = Bucket('uaprom-logs', aws_region='eu-west-1', aws_endpoint='s3-eu-west-1.amazonaws.com', aws_key='AKIAIOSFODNN7EXAMPLE', aws_secret='wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY') # List keys based on prefix lst = yield from bu.list('some-prefix') response = yield from bu.get(lst) print(len(response)) response = yield from bu.download(lst) print("GOT Response", dir(response)) while 1: chunk = yield from response.read(65536) print("Received", len(chunk)) if not chunk: break asyncio.get_event_loop().run_until_complete(main())
Lists items which start with prefix. Each returned item is a Key object. This method is coroutine.
This method raises assertion error if there are more keys than max_keys. We do not have a method to return keys iteratively yet.
Represents an S3 key returned by Bucket.list. Key has at least the following attributes: