check if a key exists in a bucket in s3 using boto3
Boto 2’s boto.s3.key.Key object used to have an exists method that checked if the key existed on S3 by doing a HEAD request and looking at the the result, but it seems that that no longer exists. You have to do it yourself: import boto3 import botocore s3 = boto3.resource(‘s3’) try: s3.Object(‘my-bucket’, ‘dootdoot.jpg’).load() except botocore.exceptions.ClientError … Read more