pythonfirebasefirebase-storagepyrebase

firebase storage download does not work using pyrebase


I am trying to read the list of files in firebase storage, determine what to download, and download the target. But neither reading file list nor downloading file works.

First, I tried to get the list of storage :

storage = firebase.storage()
print(storage.child('version').list_files()

and got the error message :

Traceback (most recent call last):
  File "C:\Users\bboyc\PycharmProjects\pymoonchild\.venv\checkRecentVersion.py", line 38, in <module>
    print(storage.child('version').list_files())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\bboyc\PycharmProjects\pymoonchild\.venv\Lib\site-packages\pyrebase\pyrebase.py", line 539, in list_files
    return self.bucket.list_blobs()
           ^^^^^^^^^^^
AttributeError: 'Storage' object has no attribute 'bucket'

I searched a little bit and it seems that I should use service account or something, and decided to not use it since what I am now building is for public distribution app.

Next I tried to make direct downloading code :

storage.child('version/test0.14.1.zip').download(path='',filename='test.zip')

And no error appeared, but the file download also did not get processed . Youtube and stackOverflow search result did not work for me. Now I am lost. I don't think that it is matter of permission, since No permission error did not appeared .

What am I missing ?


Solution

  • It was my dumb at setting permission at firestore storage.

    match /version/{allPaths=**}{
          allow read;
        }
    

    You must be careful when adding / .