Reputation:
I have a python web app.When I try to connect to the firebase with firebase admin I get error.This is how I tried to connect.
from firebase_admin import db
ref = db.reference('server/data')
And the error i get is
'string.'.format(url))
ValueError: Invalid databaseURL option: "None". databaseURL must be a non-empty URL string.
How can someone tell me how to do this correctly
Upvotes: 1
Views: 1192
Reputation: 1115
As the error tells you forgot to initialize the Firebase SDK as the dataBaseURL is not set, have a look here how to do the initialization:
https://firebase.googleblog.com/2017/07/accessing-database-from-python-admin-sdk.html
From there:
import firebase_admin from firebase_admin import credentials cred = credentials.Cert('path/to/serviceKey.json') firebase_admin.initialize_app(cred, { 'databaseURL' : 'https://my-db.firebaseio.com' })
Upvotes: 2