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

head_object or an async way to check if object exists in an S3 bucket. #346

Open
etep opened this issue Jul 31, 2024 · 1 comment
Open

Comments

@etep
Copy link

etep commented Jul 31, 2024

Description

Using boto3, one can check if an object exists in a bucket using method head_object, see, e.g.:
https://stackoverflow.com/questions/33842944/check-if-a-key-exists-in-a-bucket-in-s3-using-boto3

The head_object method does not appear to be implemented in aioboto3.

@mjpieters
Copy link

What makes you think it isn't implemented? head_object is a method defined in the S3 service description, and works just fine:

session = aioboto3.Session()
async with session.client("s3") as client:
    await client.head_object(Bucket="bucket-name", Key="object-key")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants