Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New example of get_object #1062

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading