Package: aiobotocore-chrisglass
Async client for amazon services usingbotocoreandaiohttp/asyncio.This library is a mostly full featured asynchronous version of botocore.Install$ pip install aiobotocoreBasic Exampleimportasynciofromaiobotocore.sessionimportget_sessionAWS_ACCESS_KEY_ID="xxx"AWS_SECRET_ACCESS_KEY="xxx"asyncdefgo():bucket='dataintake'filename='dummy.bin'folder='aiobotocore'key='{}/{}'.format(folder,filename)session=get_session()asyncwithsession.create_client('s3',region_name='us-west-2',aws_secret_access_key=AWS_SECRET_ACCESS_KEY,aws_access_key_id=AWS_ACCESS_KEY_ID)asclient:# upload object to amazon s3data=b'\x01'*1024resp=awaitclient.put_object(Bucket=bucket,Key=key,Body=data)print(resp)# getting s3 object properties of file we just uploadedresp=awaitclient.get_object_acl(Bucket=bucket,Key=key)print(resp)# get object from s3response=awaitclient.get_object(Bucket=bucket,Key=key)# this will ensure the connection is correctly re-used/closedasyncwithresponse['Body']asstream:assertawaitstream.read()==data# list s3 objects using paginatorpaginator=client.get_paginator('list_objects')asyncforresultinpaginator.paginate(Bucket=bucket,Prefix=folder):forcinresult.get('Contents',[]):print(c)# delete object from s3resp=awaitclient.delete_object(Bucket=bucket,Key=key)print(resp)loop=asyncio.get_event_loop()loop.run_until_complete(go())Context Manager ExamplesfromcontextlibimportAsyncExitStackfromaiobotocore.sessionimportAioSession# How to use in existing context managerclassManager:def__init__(self):self._exit_stack=AsyncExitStack()self._s3_client=Noneasyncdef__aenter__(self):session=AioSession()self._s3_client=awaitself._exit_stack.enter_async_context(session.create_client('s3'))asyncdef__aexit__(self,exc_type,exc_val,exc_tb):awaitself._exit_stack.__aexit__(exc_type,exc_val,exc_tb)# How to use with an external exit_stackasyncdefcreate_s3_client(session:AioSession,exit_stack:AsyncExitStack):# Create client and add cleanupclient=awaitexit_stack.enter_async_context(session.create_client('s3'))returnclientasyncdefnon_manager_example():session=AioSession()asyncwithAsyncExitStack()asexit_stack:s3_client=awaitcreate_s3_client(session,exit_stack)# do work with s3_clientSupported AWS ServicesThis is a non-exuastive list of what tests aiobotocore runs against AWS services. Not all methods are tested but we aim to test the majority of
commonly used methods.ServiceStatusS3WorkingDynamoDBBasic methods testedSNSBasic methods testedSQSBasic methods testedCloudFormationStack creation testedKinesisBasic methods testedDue to the way boto3 is implemented, its highly likely that even if services are not listed above that you can take anyboto3.client(‘service’)and
stickawaitinfront of methods to make them async, e.g.await client.list_named_queries()would asynchronous list all of the named Athena queries.If a service is not listed here and you could do with some tests or examples feel free to raise an issue.Run TestsMake 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
$ pipenv sync --devExecute tests suite:$ py.test -v testsMailing Listhttps://groups.google.com/forum/#!forum/aio-libsRequirementsPython3.6+aiohttpbotocoreawscliawscli depends on a single version of botocore, however aiobotocore only supports a
specific range of botocore versions. To ensure you install the latest version of
awscli that your specific combination or aiobotocore and botocore can support use:pip install -U aiobotocore[awscli]Changes1.4.1 (2021-08-24)put backwards incompatible changes behindAIOBOTOCORE_DEPRECATED_1_4_0_APISenv var.  This means that#876will not work unless this env var has been set to 0.1.4.0 (2021-08-20)fix retries via config#877remove AioSession and get_session top level names to matchbotocorechange exceptions raised to match those ofbotocore, seemappings1.3.3 (2021-07-12)fix AioJSONParser#8721.3.2 (2021-07-07)Bump tobotocoreto1.20.1061.3.1 (2021-06-11)TCPConnector: change deprecated ssl_context to sslfix non awaited generate presigned url calls#8681.3.0 (2021-04-09)Bump tobotocoreto1.20.49#8561.2.2 (2021-03-11)Await call to async method _load_creds_via_assume_role#858(thanks@puzza007)1.2.1 (2021-02-10)verify strings are now correctly passed to aiohttp.TCPConnector#851(thanks@FHTMitchell)1.2.0 (2021-01-11)bump botocore to1.19.52use passed in http_session_cls param to create_client#7971.1.2 (2020-10-07)fix AioPageIterator search method #831 (thanks@joseph-jones)1.1.1 (2020-08-31)fix s3 region redirect bug #8251.1.0 (2020-08-18)bump botocore to 1.17.441.0.7 (2020-06-04)fix generate_db_auth_token via #8161.0.6 (2020-06-04)revert __getattr__ fix as it breaks ddtrace1.0.5 (2020-06-03)Fixed AioSession.get_service_data emit call #811 via #812Fixed async __getattr__ #789 via #8031.0.4 (2020-04-15)Fixed S3 Presigned Post not being async1.0.3 (2020-04-09)Fixes typo when using credential process1.0.2 (2020-04-05)Disable Client.__getattr__ emit for now #7891.0.1 (2020-04-01)Fixed signing requests with explicit credentials1.0.0 (2020-03-31)API breaking: The result of create_client is now a required async context classCredential refresh should now workgenerate_presigned_url is now an async call along with other credential methodsCredentials.[access_key/secret_key/token] now raise NotImplementedError because
they won’t call refresh like botocore. Instead should use get_frozen_credentials
async methodBump botocore and extras0.12.0 (2020-02-23)Bump botocore and extrasDrop support for 3.5 given we are unable to test it with moto
and it will soon be unsupportedRemove loop parameters for Python 3.8 complianceRemove deprecated AioPageIterator.next_page0.11.1 (2020-01-03)Fixed event streaming API calls like S3 Select.0.11.0 (2019-11-12)replace CaseInsensitiveDict with urllib3 equivalent #744
(thanks to inspiration from @craigmccarter and @kevchentw)bump botocore to 1.13.14fix for mismatched botocore method replacements0.10.4 (2019-10-24)Make AioBaseClient.close method async #724 (thanks @bsitruk)Bump awscli, boto3, botocore #735 (thanks @bbrendon)switch paginator to async_generator, add result_key_iters
(deprecate next_page method)0.10.3 (2019-07-17)Bump botocore and extras0.10.2 (2019-02-11)Fix response-received emitted event #6820.10.1 (2019-02-08)Make tests pass with pytest 4.1 #669 (thanks @yan12125)Support Python 3.7 #671 (thanks to @yan12125)Update RTD build config #672 (thanks @willingc)Bump to botocore 1.12.91 #6790.10.0 (2018-12-09)Update to botocore 1.12.49 #639 (thanks @terrycain)0.9.4 (2018-08-08)Add ClientPayloadError as retryable exception0.9.3 (2018-07-16)Bring botocore up to date0.9.2 (2018-05-05)bump aiohttp requirement to fix read timeouts0.9.1 (2018-05-04)fix timeout bug introduced in last release0.9.0 (2018-06-01)bump aiohttp to 3.3.xremove unneeded set_socket_timeout0.8.0 (2018-05-07)Fix pagination #573 (thanks @adamrothman)Enabled several s3 tests via motoBring botocore up to date0.7.0 (2018-05-01)Just version bump0.6.1a0 (2018-05-01)bump to aiohttp 3.1.xswitch tests to Python 3.5+switch to native coroutinesfix non-streaming body timeout retries0.6.0 (2018-03-04)Upgrade to aiohttp>=3.0.0 #536 (thanks @Gr1N)0.5.3 (2018-02-23)Fixed waiters #523 (thanks @dalazx)fix conn_timeout #4850.5.2 (2017-12-06)Updated awscli dependency #4610.5.1 (2017-11-10)Disabled compressed response #4300.5.0 (2017-11-10)Fix error botocore error checking #190Update supported botocore requirement to: >=1.7.28, <=1.7.40Bump aiohttp requirement to support compressed responses correctly #2980.4.5 (2017-09-05)Added SQS examples and tests #336Changed requirements.txt structure #336bump to botocore 1.7.4Added DynamoDB examples and tests #3400.4.4 (2017-08-16)add the supported versions of boto3 to extras require #3240.4.3 (2017-07-05)add the supported versions of awscli to extras require #273 (thanks @graingert)0.4.2 (2017-07-03)update supported aiohttp requirement to: >=2.0.4, <=2.3.0update supported botocore requirement to: >=1.5.71, <=1.5.780.4.1 (2017-06-27)fix redirects #2680.4.0 (2017-06-19)update botocore requirement to: botocore>=1.5.34, <=1.5.70fix read_timeout due to #245implement set_socket_timeout0.3.3 (2017-05-22)switch to PEP 440 version parser to support ‘dev’ versions0.3.2 (2017-05-22)Fix botocore integrationProvisional fix for aiohttp 2.x stream supportupdate botocore requirement to: botocore>=1.5.34, <=1.5.520.3.1 (2017-04-18)Fixed Waiter support0.3.0 (2017-04-01)Added support for aiohttp>=2.0.4 (thanks @achimnol)update botocore requirement to: botocore>=1.5.0, <=1.5.330.2.3 (2017-03-22)update botocore requirement to: botocore>=1.5.0, <1.5.290.2.2 (2017-03-07)set aiobotocore.__all__ for * imports #121 (thanks @graingert)fix ETag in head_object response #1320.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 paramremove AioConfig limit connector_arg as this is now handled by
by the Configmax_pool_connectionsproperty (note default is 10)0.1.1 (2017-01-16)botocore updated to version 1.5.00.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