How to check if data exist in firebase. (KivyMD Python)

I’m new to Python and KivyMD. Also to working with Databases. I want to check if the data provided by the user using the KivyMD App is already in the Firebase Realtime Database. These are the data in the firebase.

Data in Firebase

The Code

def send_data(self, email):
    from firebase import firebase

    firebase = firebase.FirebaseApplication("", None)

    data = {
        'Email' : email

    if email.split() == []:
        cancel_btn_checkpoint_dialogue = MDFlatButton(text='Retry', on_release=self.close_checkpoint_dialogue)
        self.checkpoint_dialog = MDDialog(title='Access Denied', text="Invalid Username"),

    else:'Users', data)

If the user enters an existing value in the database, that value should not be saved in the database. Also a Dialog box should be shown that the email is already in use. If the value provided by the user is not in the database it should be saved. Please help me to do this.


Did you try with firebase_admin?

I check my data with like this:

import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore

cred = credentials.Certificate(
db = firestore.client()
data = {
    "Email" : email

query_email = db.collection(u'Users') 
if query_email:  
    # exists
    # does not exist

If user email does not exist, query_email is going to be empty list. Do not forget that query_email is not json data. You can convert it json with to_dict():

email_query_result_as_json = query_email[0].to_dict()