Last active
November 7, 2022 16:39
-
-
Save kgriffs/6aad0af419d755f809e1c3eea051e565 to your computer and use it in GitHub Desktop.
aiobotocore config example (vs. boto3) for setting connect_timeout and usign the standard retries mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import aiobotocore.session | |
import aiobotocore.config | |
async def example(): | |
# Equivalent to boto3.client('s3', config=botocore.client.Config(**kwargs)) | |
# See also for available options: | |
# * https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html | |
# * https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html | |
config = aiobotocore.config.AioConfig( | |
connect_timeout=5, | |
retries=dict(mode='standard'), | |
) | |
session = aiobotocore.session.get_session() | |
async with session.create_client('s3', config=config) as client: | |
pass | |
asyncio.run(example()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment