firebase

How to print out all values in dictionary using for loop

How to print out all values in dictionary using for loop Question: Hello I am trying to print out all values of an object from Firebase in Python but instead , it prints only the first value @app.route(‘/get_racer’,methods=[‘GET’] ) data = db.(“child”).get() for x in data.each(): print(x.val() ) Asked By: Kevin Fiadzeawu || Source Answers: …

Total answers: 1

How to access firebase database without having 'Realtime Database'? [python]

How to access firebase database without having 'Realtime Database'? [python] Question: Im trying to connect my python script to a Firebase database. Here is the code: import firebase_admin from firebase_admin import credentials, db cred = credentials.Certificate("irebase-adminsdk-ofcmd-bwd7fbcz2c.json") firebase_admin.initialize_app(cred, {‘databaseURL’:’https://company.firebaseio.com/’}) ref = db.reference(‘/users’).get() The ERROR Im facing looks like this: requests.exceptions.HTTPError: 404 Client Error: Not Found for …

Total answers: 1

Python Realtime Database (Google Firebase) sending Integer instead of JSON file to servers

Python Realtime Database (Google Firebase) sending Integer instead of JSON file to servers Question: While coding in python in many projects, I’ve encountered the error of firebase’s RealTime Database sending an integer instead of the json file. I’ve checked and I’ve imported the JSON packages, loaded the correct files (etc) Here is the following code: …

Total answers: 1

FirebaseMessaging.getToken() using python

FirebaseMessaging.getToken() using python Question: I’m building a kivy app and almost got firebase cloud messaging working using the pyfcm package from pypi. What i’m stuck on is how to get the "registration token" that the firebase SDK creates on app install so that i have a registration token to send push notifications to. There seems …

Total answers: 1

Firebase credentials as Python environment variables: Could not deserialize key data

Firebase credentials as Python environment variables: Could not deserialize key data Question: I’m developing a Python web app with a Firestore realtime database using the firebase_admin library. The Firestore key comes in form of a .json file containing 10 variables. However, I want to store some of these variables as environment variables so they are …

Total answers: 2

Check if entry exists in Firebase Realtime Databse (Python)

Check if entry exists in Firebase Realtime Databse (Python) Question: I am currently trying to retrieve login information from my Realtime DB in Firebase. As an example, I want to detect whether the provided username already exists in the db. Here is a code snippet I’m attemping to work with. ref.child("Users").order_by_child("Username").equal_to("Hello").get() It does not however …

Total answers: 1

Initializing 2 firebase apps in python

Initializing 2 firebase apps in python Question: As part of my project, I’ve made 2 different Firestore databases. Usually, when I work with 1, it sets up fine in my project file. Now that I’m implementing BOTH of them in my python file (running discord.py), it throws up an error! Here’s the code for reference: …

Total answers: 1

how to delete document without deleting collection in firestore?

how to delete document without deleting collection in firestore? Question: I want to create some kind of collection which cannot be deleted. The reason I made it like that is because when the document is empty my website can’t do the data creation process is it possible to create a collection in firestore that has …

Total answers: 1

Token used too early error thrown by firebase_admin auth's verify_id_token method

Token used too early error thrown by firebase_admin auth's verify_id_token method Question: Whenever I run from firebase_admin import auth auth.verify_id_token(firebase_auth_token) It throws the following error: Token used too early, 1650302066 < 1650302067. Check that your computer’s clock is set correctly. I’m aware that the underlying google auth APIs do check the time of the token, …

Total answers: 2

Initializing Firebase Admin via Environment Variables without storing serviceAccount.json

Initializing Firebase Admin via Environment Variables without storing serviceAccount.json Question: I am trying to initialize firebase-admin on my Flask API. Based off the documentation, the method initialize_app can take a dictionary as an input as seen here: https://github.com/firebase/firebase-admin-python/blob/6d826fd15c87db62f7501f569b6e0a762d17a05e/firebase_admin/credentials.py#L85 That said, I structured my code as follows: import firebase_admin from firebase_admin import auth, credentials … firebase_admin.initialize_app({ …

Total answers: 3