def bucket_exists(access_key, secret_key, bucket_name):
 if (not bucket_name):
  return False
 connection = connect_s3(access_key, secret_key)
 if (bucket_name != bucket_name.lower()):
  connection.calling_format = OrdinaryCallingFormat()
 try:
  connect_s3(access_key, secret_key).head_bucket(bucket_name)
 except exception.S3ResponseError as e:
  if (e.status not in (301, 302)):
   return False
 return True

def bucket_exists ( access_key , secret_key , bucket_name ) : if ( not bucket_name ) : return False connection = connect_s3 ( access_key , secret_key ) if ( bucket_name != bucket_name . lower ( ) ) : connection . calling_format = OrdinaryCallingFormat ( ) try : connect_s3 ( access_key , secret_key ) . head_bucket ( bucket_name ) except exception . S3ResponseError as e : if ( e . status not in ( 301 , 302 ) ) : return False return True
tests for the existance of a bucket and if the user can access it with the given keys .