'how to retrieve the specific data from firebase realtime database using python?

I want to retrieve the specific data from realtime database in python file. I need to setup a connection first but I don't know how to set it up and then retrieve the intended data.

Here is my sample Realtime database state:

  • Locations
    • Ansoo Lake
      • category: "lake"
      • rating: "4.5"
      • otherAttributes: "abc"
      • name: "Ansoo Lake"
    • Deosai National Park
      • category: "national park"
      • rating: "4"
      • otherAttributes: "xyz"
      • name: "Deosai National Park"
  • Hotels
  • Activities

With Locations being the parent node in realtime database and there are other nodes as well(i.e., Hotels and Activities which are not my concern here). I need to retrieve the location name based on a specific category in python.



Sources

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

Source: Stack Overflow

Solution Source