首页 > 解决方案 > PYREBASE - 我有一个用于某人的 firebase 应用程序的 APIKey,我想查看他们存储桶中的文件

问题描述

使用 python3 pyrebase 模块:我知道一些文件名,我可以通过 访问它们storage.child(),但我想获取存储中文件的完整列表。我试过了


    import pyrebase
    
    config = {
      "apiKey": "apiKey",
      "authDomain": "projectId.firebaseapp.com",
      "databaseURL": "https://databaseName.firebaseio.com",
      "storageBucket": "projectId.appspot.com"
    }
    
    firebase = pyrebase.initialize_app(config)

storage = firebase.storage()
files = storage.list_files()

但它仍然返回

AttributeError: 'Storage' object has no attribute 'bucket'

同样,我不拥有 firebase 数据库,我仍然拥有 API 密钥,而不是 serviceAccount json 文件。

更新:我已经提取并授权承载密钥。我可以用它来授权登录吗?

标签: pythonfirebasegoogle-cloud-storagefirebase-storagepyrebase

解决方案


根据这个问题,您需要将服务帐户凭据添加到您的配置中,如此所述。

您可以按照文档创建和下载密钥。


推荐阅读