samedi 2 mai 2015

Its possible check if a bucket name already exist?

I have a method that needs a name to create a new bucket.

And I want to show a message "bucket name already exist" if the bucket name already exist.

It is possible to check if a bucket name already exist?

def createBucket(bucketName):
    c = boto.s3.connect_to_region("us-east-1")
    # if bucketName exist: 
        print "bucket name already exist"
    else:
        bucket = c.create_bucket(bucketName)


bucket = createBucket(raw_input("Bucket name: "))   




Aucun commentaire:

Enregistrer un commentaire