Skip to main content

aiobotocore

https://travis-ci.org/aio-libs/aiobotocore.svg?branch=master https://codecov.io/gh/aio-libs/aiobotocore/branch/master/graph/badge.svg https://img.shields.io/pypi/v/aiobotocore.svg

Async client for amazon services using botocore and aiohttp/asyncio.

Main purpose of this library to support amazon s3 api, but other services should work (may be with minor fixes). For now we have tested only upload/download api for s3, other users report that SQS and Dynamo services work also. More tests coming soon.

Install

$ pip install aiobotocore

Basic Example

import asyncio
import aiobotocore

AWS_ACCESS_KEY_ID = "xxx"
AWS_SECRET_ACCESS_KEY = "xxx"


async def go(loop):
    bucket = 'dataintake'
    filename = 'dummy.bin'
    folder = 'aiobotocore'
    key = '{}/{}'.format(folder, filename)

    session = aiobotocore.get_session(loop=loop)
    async with session.create_client('s3', region_name='us-west-2',
                                   aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
                                   aws_access_key_id=AWS_ACCESS_KEY_ID) as client:
        # upload object to amazon s3
        data = b'\x01'*1024
        resp = await client.put_object(Bucket=bucket,
                                            Key=key,
                                            Body=data)
        print(resp)

        # getting s3 object properties of file we just uploaded
        resp = await client.get_object_acl(Bucket=bucket, Key=key)
        print(resp)

        # delete object from s3
        resp = await client.delete_object(Bucket=bucket, Key=key)
        print(resp)

        # list s3 objects using paginator
        paginator = client.get_paginator('list_objects')
        async for result in paginator.paginate(Bucket=bucket, Prefix=folder):
            for c in result.get('Contents', []):
                print(c)

        # get object from s3
        response = await client.get_object(Bucket=bucket, key=key)
        # this will ensure the connection is correctly re-used/closed
        async with response['Body'] as stream:
            bytes = await stream.read()

loop = asyncio.get_event_loop()
loop.run_until_complete(go(loop))

Run Tests

Make sure you have development requirements installed and your amazon key and secret accessible via environment variables:

$ cd aiobotocore
$ export AWS_ACCESS_KEY_ID=xxx
$ export AWS_SECRET_ACCESS_KEY=xxx
$ pip install -Ur requirements-dev.txt

Execute tests suite:

$ py.test -v tests

Mailing List

https://groups.google.com/forum/#!forum/aio-libs

Requirements

Changes

0.2.3 (XXXX-XX-XX)

0.2.2 (2017-03-07)

  • set aiobotocore.__all__ for * imports #121 (thanks @graingert)

  • fix ETag in head_object response #132

0.2.1 (2017-02-01)

  • Normalize headers and handle redirection by botocore #115 (thanks @Fedorof)

0.2.0 (2017-01-30)

  • add support for proxies (thanks @jjonek)

  • remove AioConfig verify_ssl connector_arg as this is handled by the create_client verify param

  • remove AioConfig limit connector_arg as this is now handled by by the Config max_pool_connections property (note default is 10)

0.1.1 (2017-01-16)

  • botocore updated to version 1.5.0

0.1.0 (2017-01-12)

  • Pass timeout to aiohttp.request to enforce read_timeout #86 (thanks @vharitonsky) (bumped up to next semantic version due to read_timeout enabling change)

0.0.6 (2016-11-19)

  • Added enforcement of plain response #57 (thanks @rymir)

  • botocore updated to version 1.4.73 #74 (thanks @vas3k)

0.0.5 (2016-06-01)

  • Initial alpha release

Metadata

Release files for aiobotocore-botorange 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiobotocore-botorange 0.1.0
File Size Uploaded
aiobotocore-botorange-0.1.0.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiobotocore-botorange 0.1.0
File Interpreter ABI Platform
aiobotocore_botorange-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / aiobotocore-botorange-0.1.0.tar.gz

Download URL aiobotocore-botorange-0.1.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
62312ea3482bbb38b35a5a7a6a7e71bb3565d6758e839bc638d84e6811dda9e6
BLAKE2b-256 checksum
How to use checksums
0b89065ec21b57987daa3a71b3ebe3d96173fe5a6eb082730ce78f60cad1fff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / aiobotocore_botorange-0.1.0-py3-none-any.whl

Download URL aiobotocore_botorange-0.1.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ffbbe13606152b7fa22be5a2817fe791a335b93c17b9babc9f0cb0d16fe6f23
BLAKE2b-256 checksum
How to use checksums
ecf43dc639b6b6d1175f22b15e66c91d525de1774df7d1ed4a76cd3ba5ba0515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page