chroma / firebase_handler.py
anubhav77's picture
Persistence with db
30ebce4
raw
history blame contribute delete
731 Bytes
from firebase import firebase
import os
secret=os.environ['FIREBASE_TOKEN']
user_id="123"
auth=firebase.FirebaseAuthentication(secret=secret,email="[email protected]",extra={"id":user_id})
fb_url="https://device-1a455.firebaseio.com"
fb= firebase.FirebaseApplication(fb_url,auth)
base_dir="/users/"+user_id
def fb_get(item):
""" item need to be in format d2_refreshtoken same name will be present in the firebase
d2 means second dropbox instance or app.
"""
return fb.get(base_dir,item)
def fb_update(item,value):
""" item need to be in format d2_refreshtoken same name will be present in the firebase
d2 means second dropbox instance or app.
"""
return fb.patch(base_dir,{item:value})