Python 3.x 从Firebase存储中下载Blob返回403

Python 3.x 从Firebase存储中下载Blob返回403,python-3.x,firebase-storage,Python 3.x,Firebase Storage,我试图从Firebase存储下载一个文件,但是当我使用函数donwload_to_filename或download_as_string时,我得到一个错误。我的代码如下: 使用函数“下载到文件名” client = storage2.Client() buckets = client.list_buckets() for bucket in buckets: print(bucket.name) bucket = client.get_bucket('tmjback.appspot.c

我试图从Firebase存储下载一个文件,但是当我使用函数donwload_to_filename或download_as_string时,我得到一个错误。我的代码如下:

使用函数“下载到文件名”

client = storage2.Client()
buckets = client.list_buckets()
for bucket in buckets:
     print(bucket.name)
bucket = client.get_bucket('tmjback.appspot.com')
#blobs = list(bucket.list_blobs())
list_of_blobs = list(bucket.list_blobs(prefix="informe/ordenes/14731d14000000/124b399e000000"))
print(len(list_of_blobs))

path_to_file = str(BASE_DIR) + "test" + ".txt"
file = open(path_to_file, 'w+')
file.write("")
file.close()

Blob.download_to_filename(path_to_file)
我得到这个错误

TypeError: download_to_filename() missing 1 required positional argument: 'filename'
TypeError: download_to_filename() missing 1 required positional argument: 'self'
所以我试着这样:

Blob.download_to_filename(filename=path_to_file)
但是我得到了这个错误

TypeError: download_to_filename() missing 1 required positional argument: 'filename'
TypeError: download_to_filename() missing 1 required positional argument: 'self'
使用函数下载\u作为\u字符串

client = storage2.Client()
buckets = client.list_buckets()
for bucket in buckets:
     print(bucket.name)
bucket = client.get_bucket('tmjback.appspot.com')
#blobs = list(bucket.list_blobs())
list_of_blobs = list(bucket.list_blobs(prefix="path/to/folder"))
print(len(list_of_blobs))

blob = Blob.from_string("gs://path/to/folder")
file = blob.download_as_string(client=client)
file = file.loads(file)
错误

google.api\u core.exceptions.probled:403获取https://storage.googleapis.com/download/storage/v1/b/informe/o/ordenes%2F14731d14000000%2F124b399e000000%2F201908.json?alt=media: ('Request failed with status code',403',应为其中一个',)
我正在使用具有所有者权限的用户的凭据 我做错了什么