Skip to content

Instantly share code, notes, and snippets.

@alaa-aqeel
Created March 27, 2018 11:52
Show Gist options
  • Save alaa-aqeel/c1f47b79e0dea775f995a278ee3909e5 to your computer and use it in GitHub Desktop.
Save alaa-aqeel/c1f47b79e0dea775f995a278ee3909e5 to your computer and use it in GitHub Desktop.
Class Python With Firebasee Google
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