python - 存储桶名称必须以数字或字母开头和结尾
问题描述
我正在尝试将.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.
有任何想法吗?
解决方案
get_bucket 采用不带“gs://”且不带斜杠(不是数字或字母,因为错误消息提醒您)的存储桶名称。
bucket = storer.get_bucket('project_name.appspot.com')
推荐阅读
- docker - Docker 预构建镜像 delpoy 到 Heroku
- sql - 在 SQL 中将相应的列插入到更大的表中
- javascript - sql 查询可以因列而异吗?
- python - 使用 PYTHON 放置在循环中时,计数返回零
- web - 是否有带有 DRM 的开源视频平台?
- puppeteer - PuppeteerSharp:无法启动 Chromium
- c++ - 是什么导致继承和成员之间结构大小的差异?
- node.js - 获取 sftp 服务器的所有支持的 KexAlgorithms
- api - 隐藏从提琴手或其他应用程序获取请求的请求/响应标头
- amazon-web-services - CloudWatch 规则不会触发 Lambda 函数,即使具有正确的权限