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

Download Not Working #443

Open
snehitvaddi opened this issue May 12, 2023 · 3 comments
Open

Download Not Working #443

snehitvaddi opened this issue May 12, 2023 · 3 comments

Comments

@snehitvaddi
Copy link

snehitvaddi commented May 12, 2023

firebase = pyrebase.initialize_app(config)
storage = firebase.storage()
with open("filenames.txt", "r") as f:
    for i in f.readlines():
        try:
            storage.child(i).download("downloads/")

The cell is getting executed but nothing is getting downloaded

@AsifArmanRahman
Copy link

You're doing it wrong. Check documentation here

@snehitvaddi
Copy link
Author

Okay, Thank you
In that case, will below code shouls work?

storage = firebaseApp.storage()
storage.child(<firebase_file_path.jpg>).download("downloads/")

I tried this, but didn't work. So, is userToken mandatory for download?
If yes, where can I get the uer token from?

@AsifArmanRahman
Copy link

  1. Token could be mandatory based on your security rules for storage.

  2. The below code should work, as you can see, I'm defining a filename with extension for that file in the download method.

storage = firebaseApp.storage()
storage.child("firebase_file_path/file.jpg").download("downloads/download.jpg")

Note: the downloads folder might not be created on your local machine automatically if it doesn't exist already which should throw an error. Also if it fails with pyrebase, please try the firebase-rest-api library.

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

No branches or pull requests

2 participants