Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. try:
  2.     s3.meta.client.head_bucket(Bucket='mybucket')
  3. except botocore.exceptions.ClientError as e:
  4.     # If a client error is thrown, then check that it was a 404 error.
  5.     # If it was a 404 error, then the bucket does not exist.
  6.     error_code = int(e.response['Error']['Code'])
  7.     if error_code == 404:
  8.         exists = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement