Skip to content

Instantly share code, notes, and snippets.

@kgriffs
Last active November 7, 2022 16:39
Show Gist options
  • Save kgriffs/6aad0af419d755f809e1c3eea051e565 to your computer and use it in GitHub Desktop.
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
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