存储桶名称必须以数字或字母开头和结尾

Pal*_*hah 2 python google-cloud-storage firebase google-cloud-platform

我正在尝试将.sav文件上传到 firebase 存储。但每次我尝试上传时都会收到此错误:ValueError: Bucket names must start and end with a number or letter.我在网上找到的教程/问题都无法解决此问题。

我这样做的方式是:


os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = 'credentials.json'
storer = storage.Client()
bucket = storer.get_bucket('gs://project_name.appspot.com/') #I found this on the top of my storage account.

Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Dou*_*son 5

get_bucket 采用不带“gs://”且不带尾部斜杠的存储桶名称(这不是数字或字母,因为错误消息提醒您)。

bucket = storer.get_bucket('project_name.appspot.com')
Run Code Online (Sandbox Code Playgroud)