文档中心 > 创建桶
创建桶

最近更新时间:2021-09-22

对象存储桶(Bucket)是存储对象(Object)的容器。对象都隶属于桶。

创建桶的完整代码请参见GitHub

以下代码用于创建桶:

from src.ossConfig import ossConfig

import unicloud_oss.Oss as Oss


access_key = 'youraccessket'

secret_key = 'yoursecretkey'

endpoint_url = 'http://oss-cn-north-2.unicloudsrv.com'

config = ossConfig(access_key,secret_key,endpoint_url)


bucket_name = 'test1'

if Oss.create_bucket(config, bucket_name):

    print("creat bucket sucess!")

else:

    print("create bucket failed!")


if Oss.bucket_exists(config, bucket_name):

    print("bucket exists!")

else:

    print("no bucket")