简体   繁体   English

如何将 firebase android 项目连接到 python firebase

[英]How to connect firebase android project to python firebase

I have a python script on my laptop in which I want to push some data continuously to firebase realtime database.Now this was easy but I had to create a web app firebase project for that. I have a python script on my laptop in which I want to push some data continuously to firebase realtime database.Now this was easy but I had to create a web app firebase project for that. Next I want to retrieve the same data from this web-app firebase database from my flutter app but I think for that I need to create an android firebase project.接下来,我想从我的 flutter 应用程序中的这个网络应用程序 firebase 数据库中检索相同的数据,但我认为为此我需要创建一个 android ZBF192E1515C25AB37 项目。

So how to send data from my python script to android firebase project?那么如何将数据从我的 python 脚本发送到 android firebase 项目?

For python I created a web app project and this was the config I received from firebase:对于 python,我创建了一个 web 应用程序项目,这是我从 firebase 收到的配置:

firebaseConfig = {
    "apiKey": "...",
    "authDomain": "...",
    "projectId": "...",
    "storageBucket": "...",
    "messagingSenderId": "...",
    "appId": "...",
    "measurementId": "..."
}

firebase = pyrebase.initialize_app(firebaseConfig)

db = firebase.database()

data = {"key":"value"}
db.push(data)

So this was easy but on my flutter app I cannot connect to the same database nor android firebase project provides the same config to connect with python.所以这很容易,但在我的 flutter 应用程序上,我无法连接到同一个数据库,也无法连接到同一个数据库,也无法连接到 android firebase 项目提供与 Z23EEEB7347BDD75BDDZ36 连接的相同配置。

So what other options I have or any solution to this problem?那么我还有什么其他选择或解决这个问题的方法?

Thanks in advance.提前致谢。

For your Python Script that runs on you laptop you should use the "Python Firebase Admin SDK".对于在笔记本电脑上运行的 Python 脚本,您应该使用“Python Firebase Admin SDK”。 It will write to your normal Firebase Database.它将写入您的普通 Firebase 数据库。 I have a Python Script running and uploading things to my Fireabse DB and my Android App can read it.我有一个 Python 脚本正在运行并将内容上传到我的 Fireabse 数据库,我的 Android 应用程序可以读取它。

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

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