python - 需要帮助使用 firebase 流式休息 api 不起作用
问题描述
我试图从我的 firebase 数据库中流式传输更改,但我编写的代码似乎不起作用。它不会产生错误,流不会关闭,因为它一直在运行,直到我取消程序,但它不仅仅是产生任何结果。它没有显示对我的数据的任何更改。我尝试将不同的数据发布到数据库以查看流是否会更新但不会更新。如果我删除它可以工作但它没有流式传输的标题,我只需获取一次数据并关闭它。下面是我的代码。不感谢帮助
import requests
import json
headers = {"Accept": "text/event-stream"}
r = requests.get("https://************************************/messages/*******.json", stream= True, headers=headers, allow_redirects=True)
if r.encoding is None:
r.encoding = 'utf-8'
for line in r.iter_lines(decode_unicode=True):
if line:
print(json.loads(line))
我按照本页底部的说明https://firebase.google.com/docs/database/rest/retrieve-data。提前致谢
解决方案
推荐阅读
- laravel - 如果网络服务器没有安装加密层,Laravel 5.7 不会生成 HTTPS 路由
- android - Do I need a new keystore when I create a new version for my app in android?
- c - 参数 #1 的不兼容类型
- typescript - 从子到父的简单绑定
- rest - XeroAccountingApiException:400:发票的修改状态无效
- azure - 在 Power BI 中显示来自 Azure 流的当前(最新)值
- networking - 扫描网络并查找设备
- r - 从 as.date() 生成 4 位数年份格式
- python-3.x - pd.read_csv 然后 pd.concat 并行处理多个 txt 文件
- java - Java Apache FTP 客户端 - 恢复中断的上传