[英]Unable to fetch data from nest using python-firebase
I tried to get data from nest using python-firebase module but I unable to fetch.我尝试使用 python-firebase 模块从巢中获取数据,但无法获取。 I follow the answer given in post What is the link between <YOUR-FIREBASE>.firebaseio.com and home.nest.com I have valid nest token.
我按照帖子中给出的答案<YOUR-FIREBASE>.firebaseio.com 和 home.nest.com 之间的链接是什么我有有效的巢令牌。
I am not sure exactly what you are trying to do but you might consider looking at the REST API instead of python-firebase.我不确定您到底要做什么,但您可能会考虑查看 REST API 而不是 python-firebase。 Here is a code sample using the requests library and ujson to read device data.
这是使用请求库和 ujson 读取设备数据的代码示例。
import requests
import ujson
s = requests.session()
auth_url = "https://api.home.nest.com/oauth2/access_token"
auth_body = {
"code": "AUTHORIZATION_CODE",
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"grant_type": "authorization_code"
}
auth_r = s.post(url=auth_url, data=auth_body)
auth_content = ujson.loads(auth_r.content)
auth_content['access_token']
devices_url = "https://developer-api.nest.com/devices?auth=" + auth_content['access_token']
devices_r = s.get(devices_url)
devices_r.json()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.