'Pyrebase: from second get().val() returns None

Hello I'm a newcomer to python.

I'm now trying to associate Firebase Realtime Database with python, using module 'pyrebase'. It worked fine until I added the last three lines.

import pyrebase

with open("auth.json") as fo:
    config = json.load(fo) #this json has config

firebase = pyrebase.initialize_app(config)
db = firebase.database()

uid = '000000'

drtr = db.child('users').child(uid).child('info').get()
usr_id = drtr.child('id').get()
usr_pw = drtr.child('pw').get()

print(usr_id.val())
print(usr_pw.val())
print(drtr.child('name').get().val())
print(drtr.child('sid').get().val())

the database looks like this: the realtime database(firebase)

and the python consol:

this_is_id
None
None
None

I've tried to change the order of id, pw, name, and sid line, and even gave delay for 5 seconds between them but nothing changed. Only the first line worked fine.

this is the firebase log, which shows that the code tried and successfully got the data from there:firebase log (blue, purple, orange number shows allowed, declined, error-occured connections each)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source