Vidhi Patel
Published

Getting Started with Firebase

This article will help you how to start work with Firebase and how to send and fetch the data on real-time database.

BeginnerProtip795
Getting Started with Firebase

Things used in this project

Hardware components

Odinub
Odinub
×1

Software apps and online services

Firebase
Google Firebase

Story

Read more

Code

firebase.py

Python
#to fetch the data from the odinub
from firebase import firebase

firebase=firebase.FirebaseApplication('yourFirebaselink')
result=firebase.get('/user',None)
print(result)

#to send the data write below code
import pyrebase

config = {
    "apiKey": "XXXXXXXXXXXXXXXXXXX",
    "authDomain": "XXXXXXXXXXX.firebaseapp.com",
    "databaseURL": "https://XXXXXXXXXXX.firebaseio.com",
    "projectId": "XXXXXXXXX",
    "storageBucket": "XXXXXXXXX.appspot.com",
    "messagingSenderId": "XXXXXXXXX",
    "appId": "XXXXXXXXXXX:web:XXXXXXXXXX"
  }

firebase = pyrebase.initialize_app(config)
db = firebase.database()
db.child("names").push({"LED":"off"})

Credits

Vidhi Patel
4 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.