Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud storage 在自定义位置的Google云存储中创建bucket_Google Cloud Storage_Google Cloud Python - Fatal编程技术网

Google cloud storage 在自定义位置的Google云存储中创建bucket

Google cloud storage 在自定义位置的Google云存储中创建bucket,google-cloud-storage,google-cloud-python,Google Cloud Storage,Google Cloud Python,我想使用python客户端在欧洲的GCS中创建一个bucket from google.cloud import storage 实例化客户机 新bucket的名称 创建新的存储桶 这在美国创造了一个多地区的桶。如何将其更改为欧洲?创建桶的方法受到限制。对于更多参数,您需要创建一个bucket资源并调用其create()方法,如下所示: storage_client = storage.Client() bucket = storage_client.bucket('bucket-name')

我想使用python客户端在欧洲的GCS中创建一个bucket

from google.cloud import storage
实例化客户机 新bucket的名称 创建新的存储桶
这在美国创造了一个多地区的桶。如何将其更改为欧洲?

创建桶的
方法受到限制。对于更多参数,您需要创建一个bucket资源并调用其
create()
方法,如下所示:

storage_client = storage.Client()
bucket = storage_client.bucket('bucket-name')
bucket.create(location='EU')
Bucket.create还有一些其他属性,并且有文档记录:

您可以尝试使用以下属性:

def create_bucket(bucket_name):
storage\u client=storage.client()
bucket=存储\客户端。创建\ bucket(bucket\名称,位置='EUROPE-WEST1')
打印(“Bucket{}created.format(Bucket.name))
bucket_name = 'my-new-bucket'
bucket = storage_client.create_bucket(bucket_name)

print('Bucket {} created.'.format(bucket.name))
storage_client = storage.Client()
bucket = storage_client.bucket('bucket-name')
bucket.create(location='EU')