forked from avinashkranjan/Amazing-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebase_storage.py
More file actions
29 lines (18 loc) · 771 Bytes
/
firebase_storage.py
File metadata and controls
29 lines (18 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pyrebase
import FirebaseScripts.CredentialsHelper as credentials
firebase = pyrebase.initialize_app(credentials.get_fireBase_credentials())
storage = firebase.storage()
def send_file(firebase_path, source_path):
response = storage.child(firebase_path).put(source_path)
print(response)
return response
def delete_file(firebase_path, name_of_file_to_delete):
response = storage.child(firebase_path).delete(name_of_file_to_delete)
print(response)
return response
def download_file(firebase_path, file_name):
response = storage.child(firebase_path).download(path="./", filename=file_name)
print(response)
return response
if __name__ == "__main__":
download_file("enter your path here ", "enter your file name here ")