Async boto3 wrapper
Project description
Async AWS SDK for Python
This package is mostly just a wrapper combining the great work of boto3 and aiobotocore.
aiobotocore allows you to use near enough all of the boto3 client commands in an async manner just by prefixing the command with await.
With aioboto3 you can now usxe the higher level APIs provided by boto3 in an asynchronous manner. Mainly I developed this as I wanted to use the boto3 dynamodb Table object in some async microservices.
Whilst all resources in boto3 should work I havent tested them all, so if what your after is not in the table below then try it out, if it works drop me an issue with a simple test case and I’ll add it to the table.
Services |
Status |
---|---|
DynamoDB Service Resource |
Tested and working |
DynamoDB Table |
Tested and working |
Example
Simple example of using aioboto3 to put items into a dynamodb table
import asyncio
import aioboto3
from boto3.dynamodb.conditions import Key
async def main():
async with aioboto3.resource('dynamodb', region_name='eu-central-1') as dynamo_resource:
table = dynamo_resource.Table('test_table')
await table.put_item(
Item={'pk': 'test1', 'col1': 'some_data'}
)
result = await table.query(
KeyConditionExpression=Key('pk').eq('test1')
)
print(result['Items'])
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
# Outputs:
# [{'col1': 'some_data', 'pk': 'test1'}]
Things that either dont work or have been patched
As this library literally wraps boto3, its inevitable that some things won’t magically be async.
s3_client.copy This is performed by the s3transfer module. I believe s3_client.copy_object performs the same function
Fixed:
s3_client.download_file* This is performed by the s3transfer module. – Patched with get_object
s3_client.upload_file* This is performed by the s3transfer module. – Patched with put_object
Documentation
Docs are here - https://aioboto3.readthedocs.io/en/latest/
Examples here - https://aioboto3.readthedocs.io/en/latest/usage.html
Features
Closely mimics the usage of boto3.
Todo
More Examples
Set up docs
Look into monkey-patching the aws xray sdk to be more async if it needs to be.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template. It also makes use of the aiobotocore and boto3 libraries. All the credit goes to them, this is mainly a wrapper with some examples.
History
2.0.0 (2017-12-30)
Patched most s3transfer functions
1.1.2 (2017-11-29)
Fixup of lingering GPL license texts
0.1.0 (2017-09-25)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aioboto3-2.0.0.tar.gz
.
File metadata
- Download URL: aioboto3-2.0.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60e0545ed7d47b1a1c5278053abf086201017ba18b5a9b315d3b5c368b447d80 |
|
MD5 | f48b1e7fdcfe4ba290378fdfafed0c6b |
|
BLAKE2b-256 | b4140aa59c9de89548d5075b2f9554e4658ebdb758699147d31b3efef4a238ca |
File details
Details for the file aioboto3-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: aioboto3-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45e94b3722472caee8fc09a73bd1226845ac9f1e91342b9db4fcc19265477d56 |
|
MD5 | 00cf196fcbb2d31c831a223bb0f35847 |
|
BLAKE2b-256 | fe2f7e7a9e32d23b2bbbb557a5d07983d6bcaa750b06fad36103705124f16a79 |