-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
firebase_bro.py
48 lines (41 loc) · 1.2 KB
/
firebase_bro.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from firebase import Firebase
# Setting up Firebase configurations
# To learn how to set it up, please go through Firebase_Setup.MD
config = {
"apiKey": "",
"authDomain": "",
"databaseURL": "",
"projectID": "",
"storageBucket": "",
"messagingSenderId": "",
"appId": "",
"measurementId": "",
}
firebase = Firebase(config)
def firebase_gettin():
'''
Authentication for Firebase
'''
auth = firebase.auth()
email = "Enter your email here"
password = "Enter your password"
try:
auth.sign_in_with_email_and_password(email, password)
print("Successfully Signed In")
except:
print("Invalid Credentials")
# The path on the cloud storage of Firebase is dependent as per our setup
def send_img(path_local, path_on_cloud = "images/test.jpg"):
'''
Function to push the file into our Firebase storage
'''
# Configuration Information
storage = firebase.storage()
storage.child(path_on_cloud).put(path_local)
def send_feedback(first_name,last_name,email_id,message):
'''
Function to push feedback data to firebase
'''
db = firebase.database()
data = {"f_name":first_name,"l_name":last_name,"email":email_id,"msg" : message}
db.child("people").push(data)