Closed DannyDannyDanny closed 3 years ago
@DannyDannyDanny Were you able to figure out the issue? I'm running into a similar issue now
@zachyam Nope. I have a feeling this repo is no longer maintained. This did reignite my interest in connecting python to firebase again and I'm watching google's firecast tutorial for python.
@DannyDannyDanny
Not sure if this is useful, but the way I got the error was trying to initialize my own Firebase
class, like so:
import firebaseconfig
class Firebase():
def __init__(self):
self.firebase_config = {
'apiKey': firebaseconfig.DATABASE_CONFIG['apiKey'],
'authDomain': firebaseconfig.DATABASE_CONFIG['authDomain'],
'databaseURL': firebaseconfig.DATABASE_CONFIG['databaseURL'],
'projectId': firebaseconfig.DATABASE_CONFIG['projectId'],
'storageBucket': firebaseconfig.DATABASE_CONFIG['storageBucket'],
'messagingSenderId': firebaseconfig.DATABASE_CONFIG['messagingSenderId'],
}
self.firebase_app = pyrebase.initialize_app(self.firebase_config)
self.firebase_db = self.firebase_app.database()
def delete_user_db(self, chat_id, member):
try:
self.firebase_db.child(str(chat_id)+"/"+"members"+"/"+str(member.id)).remove()
except Exception as error:
print('Could not delete user from db', error)
return 'OK'
I took out the self.firebase_db = self.firebase_app.database()
from the __init__
and instead put it inside the delete_user_db
function, like so:
def delete_user_db(self, chat_id, member):
firebase_db = self.firebase_app.database()
try:
firebase_db.child(str(chat_id)+"/"+"members"+"/"+str(member.id)).remove()
except Exception as error:
print('Could not delete user from db', error)
return 'OK'
It worked after that.
If what you tried was exactly what your comment said, then I'm not sure, as nothing seems wrong with it
@zachyam I managed to make it work with google's own python library. See Code.
Link dead. Code gone.
is there still any solution for this?
Prerequisites
My Code
I'm just trying to get firebase <-> python to talk. I run the code using
Python3 firebaseconn.py
The error I receive
Guidance is appreciated 😽
Thank you for helping make Pyrebase better!