Created
March 18, 2020 04:18
-
-
Save rg3915/072cb99dc50445068e142c7fba878a9d to your computer and use it in GitHub Desktop.
upload file to firebase with python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
If you need upload file to Firebase with Python, use pyrebase. | |
https://github.com/thisbejim/Pyrebase | |
https://www.youtube.com/watch?v=I1eskLk0exg | |
''' | |
import pyrebase | |
# Your credentials after create a app web project. | |
config = { | |
"apiKey": "your_apiKey", | |
"authDomain": "your_authDomain", | |
"databaseURL": "your_databaseURL", | |
"projectId": "your_projectId", | |
"storageBucket": "your_storageBucket", | |
"messagingSenderId": "your_messagingSenderId", | |
"appId": "your_appId", | |
"measurementId": "your_measurementId" | |
} | |
firebase = pyrebase.initialize_app(config) | |
storage = firebase.storage() | |
path_on_cloud = "<folder>/<file>" | |
path_local = "<file>" | |
# Upload | |
storage.child(path_on_cloud).put(path_local) | |
# Download | |
storage.child(path_on_cloud).download("<file_downloaded>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment