FR: Realtime Database API
FR: Realtime Database API
- Operating System version: Ubuntu
- Firebase SDK version: 2.0
- Firebase Product: database
Describe the problem
Lack of support for Realtime Database API now in firebase-admin.
Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.
You might be interested to know, that a database API around the existing REST support is currently bring developed at https://github.com/firebase/firebase-admin-python/tree/hkj-simple-db
@hiranya911, I'm having trouble using your merged (#31) Database API, do you have any examples of using db.py? Here's what I'm trying to do with your work:
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
cred = credentials.Certificate('service-account-credentials.json')
app = firebase_admin.initialize_app(cred)
dbRef = db.Reference(path='/', app=app)
users = dbRef.child('users')
print(users)
print(users.get_value())
and I get
<firebase_admin.db.Reference object at 0x03BE3EB0>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\firebase_admin\db.py", line 131, in get_value
return self._client.request('get', self._add_suffix())
AttributeError: 'NoneType' object has no attribute 'request'
PS @galuszkak to access db.py you'll need to use pip install git+https://github.com/firebase/firebase-admin-python (and not just pip install firebase-admin) until the pip package is updated
Try something like:
app = firebase_admin.initialize_app(cred, {'dbURL' : 'https://your-db-url.firebase.com'})
ref = db.get_reference()
However, note that we are still working on this and the API is subject to change.
Thank you, I'll try this after lunch!
Once it gets closer, I can help provide examples or flesh out documentation if you'd like. The Python SDK is central to a current work project so I'd love to give back.
EDIT: that works wonderfully, thanks :)
On Jun 20, 2017 12:14 PM, "Hiranya Jayathilaka" [email protected] wrote:
Try something like:
app = firebase_admin.initialize_app(cred, {'dbURL' : 'https://your-db-url.firebase.com'}) ref = db.get_reference()
However, note that we are still working on this and the API is subject to change.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-admin-python/issues/28#issuecomment-309826537, or mute the thread https://github.com/notifications/unsubscribe-auth/AUA5LxCN2rmZvzPgGniuDf3oZSa9mFGBks5sF_3zgaJpZM4NlY4L .
Also, and sorry if I'm being a bother, but it doesn't appear that there is an implementation in this python SDK for subscribing to and handling events (like .on('child_added') in the node SDK, for example.) Could I be of any help in extending this for that?
@joshbabb We are not going to implement realtime event handling capabilities in this iteration. We will consider it for a future release, if there's enough demand for it. But feel free to document your requirements/suggestions as issues in this repo. That will help us to prioritize the features.
We will also gladly accept any code contributions you can provide us. But if you're going to implement realtime support I'd recommend you to wait until we release what we have already implemented (should be any day now -- we are just finalizing the internal approval processes).
Also please note that I've just merged #35 into master. You should update your test code as follows:
app = firebase_admin.initialize_app(cred, {'databaseURL' : 'https://your-db-url.firebase.com'})
ref = db.reference()
Thanks for the note and all your responses, @hiranya911
I'll make an issue for the request at a later time. We're going to hack what we can together for the time being :)
This was released today https://firebase.google.com/support/release-notes/admin/python#2.1.0
This is just to say that I much appreciate the great and easy to understand stuff you're doing. Keep on going!
Thanks @fugu2 :)