1

I have a python application that listens for put(add) events in my firebase database using Pyrebase but the stream feature of pyrebase is deprecated and stops listening after 30 minutes. The library is not supported anymore.

I figured out that firebase has a library for python called firebase-admin, however this does not have a streaming/listener capability for python, only for java. Is there any other way to do this?

#  get database instance
conn_instance = Database()
db = conn_instance.get_database()
storage = conn_instance.get_storage()
main_queue = Queue()


def stream_handler(message):
    # Reads stream input 
    print(message)

# Stream is created to firebase database using Pyrebase
request_stream = db.child("requests").stream(stream_handler)  

def close_application():
    #  Closes stream 
    request_stream.close()

I would like to have firebase database listener functionality for python as this is needed to process new database inputs.

5
  • 1
    "the stream feature of pyrebase is deprecated and stops listening after 30 minutes": Do you have any reference about this? Commented May 5, 2019 at 21:17
  • While the primary documentation doesn't show any examples, the API documentation has multiple references to things called "listen" or "listeners". firebase.google.com/docs/reference/admin/python/… Commented May 5, 2019 at 21:38
  • @DougStevenson Thanks for the reference ! I will procede to convert my Pyrebase code to Firebase admin code Commented May 7, 2019 at 10:10
  • @stovfl it's not officially deprecated but the pyrebase project is discontinued and not updated any longer. github.com/thisbejim/Pyrebase/issues/237 Commented May 7, 2019 at 12:46
  • 1
    This question is also answered here Commented May 16, 2019 at 12:09

1 Answer 1

1

Firebase-Admin was the answer it works like a charm and is really not so hard to convert to from pyrebase.

basically i just replaced ".stream" with ".listen" and had to change how this "Event" was processed

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.