Created
March 27, 2018 11:52
-
-
Save alaa-aqeel/c1f47b79e0dea775f995a278ee3909e5 to your computer and use it in GitHub Desktop.
Class Python With Firebasee Google
This file contains 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
from firebase import firebase | |
class Firebase: | |
def __init__(self,storage,secret=None,email=None): | |
auth = None if secret == None and email == None else firebase.FirebaseAuthentication(secret,email) | |
self.fire = firebase.FirebaseApplication('https://%s.firebaseio.com'%storage, auth) | |
def get(self,path="/"): | |
return self.fire.get(path, None) | |
def post(self,path="/",data={}): | |
return self.fire.post(path,data) | |
def put(self,path="/",key="",value=""): | |
return self.fire.put(path,key,value) | |
def delete(self,path="",key=""): | |
return self.fire.delete(path,key) | |
data = Firebase( | |
"app-py", | |
secret="", | |
email="" | |
) | |
# data.post("user",{'names':{0:'alaa'}} | |
# data.put("user/names",1,"ahmed") | |
# data.delete("user/names",1) | |
print ( data.get("/user/names") ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment