Q: How to loop through each firebase database child with python? I have this firebase data structure 

I want to print all the keys under the firebase generated keys (i.e from 3030-00-809-7702 to newNSN) so I use this code 
Inventory = db.child("Inventories").get()
for business in Inventory.each():
businessid = business.key()
productdb = db.child("Inventories").child(businessid).get()


for product in productdb.each():
    productid = product.key()
print(businessid)
print(productid)

but I what I get is this 

so only the last keys are being printed instead of all the keys. What am I doing wrongly and how can I get it to print all the keys ?

A: Just print the value at the current tree to get the whole thing 
inventory = db.child("Inventories").get()
for business in inventory.each():
    print(business.val())

Or you go iterate it, which is really inefficient to request N items from Firebase for N children.
inventorydb = db.child("Inventories")
for businessid in inventorydb.shallow().get().each():
    productdb = inventory.child(businessid)
    # print the ids
    print([id for id in productdb.shallow().get()])

