Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage.list_files() fetches all files from Firebase storage. How to list/get files from a specific path only. #305

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sharmanirudh
Copy link

@sharmanirudh sharmanirudh commented Jun 12, 2019

storage.list_files() fetches all the records from Firebase storage.

Add optional prefix argument to list_files() in Storage to fetch records only from a specific path.
eg. storage.list_files(prefix="images/paul")

storage.list_files() fetches all the records from Firebase storage.

Add optional prefix argument to list_files() in Storage to fetch records only from a specific path.
eg. storage.list_files(prefix="images/paul")
Add delete() documentation of Firebase storage
@adivaste
Copy link

adivaste commented Apr 4, 2022

It gives me error as,

Traceback (most recent call last):
File "app.py", line 24, in
files = storage.list_files()
File "/home/adivaste/.local/lib/python3.8/site-packages/pyrebase/pyrebase.py", line 439, in list_files
return self.bucket.list_blobs()
AttributeError: 'Storage' object has no attribute 'bucket'

@adivaste
Copy link

adivaste commented Apr 4, 2022

Solved my problem,

We need to download .json file of private keys from firebase project.

  • Steps :
  1. YourFirebaseProject -> Project settings ->Service accounts -> Generate new Private keys
  2. Download that .json file
  3. In "config" object add the key "serviceAccount" and set the value as "downloadedJSONFile.json"
    ex.
config = {
                       "apiKey": "****************************** ",
                        "authDomain": "***************************** ",
                        "projectId": " ********* ",
                       "storageBucket": "********************** ",
                       "messagingSenderId": "*************** ",
                       "appId": "************************** ",
                       "measurementId": "*************** ",
                       "databaseURL":"",
                       "serviceAccount":"Firebase_Service_Account_Keys.json"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants