Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try:
- s3.meta.client.head_bucket(Bucket='mybucket')
- except botocore.exceptions.ClientError as e:
- # If a client error is thrown, then check that it was a 404 error.
- # If it was a 404 error, then the bucket does not exist.
- error_code = int(e.response['Error']['Code'])
- if error_code == 404:
- exists = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement