Firebase SDK for Python: How to initialize App using apiKey?

There is the following code inside a Node.js project:

Soon.app = initializeApp({
  apiKey: "AIzaSyB4fcG8rtNWAiAtSmxmK3q3JLfMvtNCGP4",
  projectId: "soonaverse"
});

How can I do the same using the Python SDK? Is this even possible at all? I am looking at this document.

Upvotes: 1

Views: 752

Answers (1)

Tejaswari
Tejaswari

Reputation: 36

I was working with Flask using Firebase. To work with Firebase in Python you will need to install pyerbase package from here. Copy SDK setup and configuration from Firebase and paste it in config. I found this GitHub repository helpful.

from flask import Flask
import pyrebase

app = Flask(__name__)

config = {
  "apiKey": " ",
  "authDomain": " ",
  "projectId": " ",
  "storageBucket": "",
  "messagingSenderId": " ",
  "appId": " ",
  "databaseURL":" ",
  "measurementId": " "
};  

firebase=pyrebase.initialize_app(config)

@app.route('/', methods=['GET','POST'])
def index():
    return "Hello World"


if __name__ == '__main__':
    app.run(debug=True)

Upvotes: 1

Related Questions