thisbejim / Pyrebase

A simple python wrapper for the Firebase API.
2.06k stars 527 forks source link

How streaming get the data? #350

Open andyxiannn opened 4 years ago

andyxiannn commented 4 years ago

Hi all I'm new to pyrebase. This is my screenshot of database. How do I get the name when a new value is added (the child was the random number). I could not find solution hope u guys give me some suggestion. Thank you in advance.

image

Here is the code.

def stream_handler(message): print(message["event"]) # put print(message["path"]) # /-K7yGTTEp7O549EzTYtI print(message["data"]) # {'title': 'Pyrebase', "body": "etc..."} my_stream = db.child("User").stream(stream_handler)

KrrishChheda04 commented 3 years ago

finding the same solution. If you have learned then please share how to do

andyxiannn commented 3 years ago

@KrrishChheda04 this line of code are valid and correct. I found out that was a logical error in my code. try to check again the logic of your code