Sunday, 12 September 2021

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("https://infinity-mode-default-rtdb.firebaseio.com/", 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"),
                                          buttons=[cancel_btn_checkpoint_dialogue])

        self.checkpoint_dialog.open()

    else:
        firebase.post('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.



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

No comments:

Post a Comment