File size: 731 Bytes
30ebce4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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}) |