diff --git a/examples/simple.py b/examples/simple.py index 3d41c891..b3a30752 100644 --- a/examples/simple.py +++ b/examples/simple.py @@ -28,6 +28,15 @@ async def go(): resp = await client.get_object_acl(Bucket=bucket, Key=key) print(resp) + resp = await client.get_object(Bucket=bucket, Key=key) + async with resp['Body'] as stream: + await stream.read() # if you do not read the stream the connection cannot be re-used and will be dropped + print(resp) + """ + This is to ensure the connection is returned to the pool as soon as possible. + Otherwise the connection will be released after it is GC'd + """ + # delete object from s3 resp = await client.delete_object(Bucket=bucket, Key=key) print(resp)