简体   繁体   English

如何使用 Python 从 Firebase 检索数据?

[英]How to retrieve data from Firebase using Python?

I'm new to Firebase and I'm trying to retrieve some test data that I created.我是 Firebase 的新手,我正在尝试检索我创建的一些测试数据。 I'm able to connect to the database, as I get a return value of 0. When I try to pull data, I get None as the result.我能够连接到数据库,因为返回值为 0。当我尝试提取数据时,结果为 None。 I'm expecting the data in the database to be retrieve.我期待检索数据库中的数据。

import firebase_admin
from firebase_admin import credentials
from firebase_admin import db

cred = credentials.Certificate("Path to Json fire")


firebase_admin.initialize_app(cred, {'databaseURL': 'Database URL'})

ref = db.reference('Secret')

results = ref.child("test").get()

print(results)

I'm expecting the results to return the data in my database.我期待结果返回我的数据库中的数据。 However, I'm getting the result None.但是,我得到的结果是 None。

check the name of the folder in which you have the information again.再次检查包含信息的文件夹的名称。 If it is mentioned wrong, then data would be returned none.如果提到错误,则数据将返回 none。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM