I have been working on an app and have discovered accessing firebase storage using pyrebase.
import pyrebase
config = {
"apiKey": "API",
"authDomain": "DOMAIN",
"databaseURL": "URL",
"projectId": "ID",
"storageBucket": "STORE_BUCKET",
"messagingSenderId": "SEND_ID",
"appId": "APP_ID",
"serviceAccount": "PATH_TO_KEY"
}
firebase_storage = pyrebase.initialize_app(config)
storage = firebase_storage.storage()
storage = firebase_storage.storage()
storage.child("IMAGE.jpeg").put("IMAGE.jpeg")
I have been able to successfully upload files but is there any way I can upload it to a specific folder in my firebase storage??
As shown in the documentation of Pyrebase on writing files, you can specify a path on the server where to write the file by specifying that path with slashes in the
child()call. From the docs:This takes the local
example2.jpgfile and writes it into theimagesfolder on Cloud Storage with nameexample.jpg.