Badhusha
Badhusha

Reputation: 196

Pyrebase apikey not defined error

import pyrebase
config = {
apiKey: "xxxxxxxxxxxxxxxxx",
authDomain: "lab-marks.firebaseapp.com",
databaseURL: "https://lab-marks.firebaseio.com",
projectId: "lab-marks",
storageBucket: "lab-marks.appspot.com",
messagingSenderId: "9983241061112"
}

firebase=pyrebase.initialize_app(config)
db=firebase.database()
users=db.child('users').get()
print(users.val())

I am integrating python with firebase.But while I run this code I get an NameError, showing that apikey not defined.

apiKey: "xxxxxxxxxxxxxxxxxxxxx", NameError: name 'apiKey' is not defined

Upvotes: 1

Views: 2325

Answers (1)

John Sviridkov
John Sviridkov

Reputation: 41

I had the same problem.
You must make the keys in the dictionary config in quotes and then everything will work fine.
P.S: Do not forget to put in quotes and other keys.

For example:

config = {
"apiKey": "xxxxxxxxxxxxxxxxx",
"authDomain": "lab-marks.firebaseapp.com",
"databaseURL": "https://lab-marks.firebaseio.com",
"projectId": "lab-marks",
"storageBucket": "lab-marks.appspot.com",
"messagingSenderId": "9983241061112"
}

Upvotes: 4

Related Questions