首页 > 解决方案 > 存储桶名称必须以数字或字母开头和结尾

问题描述

我正在尝试将.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.

有任何想法吗?

标签: pythonfirebasegoogle-cloud-platformgoogle-cloud-storage

解决方案


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

bucket = storer.get_bucket('project_name.appspot.com')

推荐阅读