You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @hyunilmmt , thanks for reporting! Can you please share some details about your use case - can you share a small snippet or test case of an asyncio function that would make use of the client? I think we have a rough understanding - but it would be helpful for us to understand the requirements a bit better.. Thanks!
aioboto3 is the asyncio version of boto3. It'll need patching the same way boto3 is being patched. The use case is that any project using aioboto3 in async code can be tested the same way you test boto3 code.
e.g. using the sample function from the aioboto3 project:
async def main():
session = aioboto3.Session()
async with session.resource("s3") as s3:
bucket = await s3.Bucket('mybucket')
async for s3_object in bucket.objects.all():
print(s3_object)
The Session() object there won't be patched even if you used localstack_client.patch.enable_local_endpoints ().
After a brief look at how enable_local_endpoints works, and at how aioboto3 defines the Session class you probably can apply the same patch to aioboto3 and have it work transparently.
Activity
whummer commentedon Jan 24, 2023
Hi @hyunilmmt , thanks for reporting! Can you please share some details about your use case - can you share a small snippet or test case of an asyncio function that would make use of the client? I think we have a rough understanding - but it would be helpful for us to understand the requirements a bit better.. Thanks!
alexrashed commentedon Sep 28, 2023
Hi @hyunilmmt!
Is there a chance you could give us some more details on this one?
mjpieters commentedon May 23, 2024
aioboto3 is the asyncio version of boto3. It'll need patching the same way boto3 is being patched. The use case is that any project using aioboto3 in async code can be tested the same way you test boto3 code.
e.g. using the sample function from the aioboto3 project:
The
Session()object there won't be patched even if you usedlocalstack_client.patch.enable_local_endpoints ().mjpieters commentedon May 23, 2024
After a brief look at how
enable_local_endpointsworks, and at how aioboto3 defines theSessionclass you probably can apply the same patch to aioboto3 and have it work transparently.Note that the
Session.clientobject is now a client defined byaiobotocore, but it usesbotocore.client.BaseClientas the base exactly the same way boto3 / botocore use it.