How to communicate with Firebase

Hi guys! It has been a long time since a wrote a blog. So I decided to write one as I learned how to communicate with Firebase.

First, you need to make a Firebase project and make a Realtime Database.

I won't show that right now, but maybe in the future I will.

After you got it get the URL from the realtime database.

It should look like this: https://your-project-name-random-number-default-rtdb.country.firebasedatabase.app/ It's only an example. It doesn't exist.


import requests
import json

url = "https://your-project-name-random-number-default-rtdb.country.firebasedatabase.app/"
data = {
    "name": "Abdullah",
    "hobbies": ["Reading", "Coding", "Cycling"],
    "Working On": "Writing a blog"
}
response = requests.post(url, json=data)
            

You set data like the example above.

You can get and delete data by using the get() and delete() methods of requests

If you want to learn more you can see this post