Closed paxsipornax closed 1 year ago
@paxsipornax Generally using any service and getting a response back from the server would mean it's connected. All requests are checked for errors automatically so if any arises, it'll be handled on it's own to show the error.
Hopefully this snippet helps. The snippet uses firebase-rest-api, an up-to-date version of pyrebase and with feature's like Social login and Firestore.
from firebase import initialize_app
firebase = initialize_app(firebaseConfig)
db = firebase.database()
data = {"name": "Anthony 'Edward' Stark"}
db.child("test").child("users").child("Edward").set(data)
server_data = db.child("test").child("users").child("Edward").get().val()
if data == server_data:
print("connection successful")
db.child("test").remove()
else:
print("connection unsuccessful")
Thanks for information. a fix: server_data = db.child("test").child("users").child("Edward").get().val()
Issue Should already be closed!
try:
firebase = pyrebase.initialize_app(firebaseConfig) auth = firebase.auth() db = firebase.database() print("connection") except: print("unconnection")