【发布时间】:2018-08-11 04:10:47
【问题描述】:
我正在尝试将我上传到 Firebase 存储(谷歌云存储)的 excel 文件作为链接公开。当我使用 blob.make_public() 方法时,我得到一个 Forbidden 403 错误:权限不足。
我正在使用适用于 python 的 Firebase Admin SDK。据我所知,在云控制台的 IAM 部分,管理 SDK 具有编辑者和存储对象管理员角色。有什么方法可以通过python将上传的对象公开?
在文档中没有找到任何其他有用的东西: Python GCS API
谢谢。
代码示例
# Access google cloud storage bucket
bucket = firebase_admin.storage.bucket(app=app)
# Blob - Google's wrapper for objects stored in buckets
destination_blob_name = 'excelReports/' + filename + '_' + datetime.now().strftime("%b_%d_%Y_%H_%M_%S")
blob = bucket.blob(destination_blob_name)
# Upload file
blob.upload_from_filename(filename)
# Make the file available for public download by those who have the link.
blob.make_public()
【问题讨论】:
标签: python firebase google-cloud-storage firebase-admin