我正在尝试订阅来自粒子光子的事件流。 docs建议
curl -H "Authorization: Bearer {ACCESS_TOKEN_GOES_HERE}" \
https://api.particle.io/v1/events/motion-detected
我试过了
^{pr2}$但我什么也得不到,我什么意思都没有
我希望得到这样的答复:
event: motion-detected
data: {"data":"intact","ttl":"60","published_at":"2015-06-25T05:08:22.136Z","coreid":"coreid"}
event: motion-detected
data: {"data":"broken","ttl":"60","published_at":"2015-06-25T05:08:23.014Z","coreid":"coreid"}
我只是不明白curl在做什么相对于请求在做什么。 谢谢你的帮助, JR公司
Custom headers在
headers
参数中作为字典传递params
参数用于传递URL parameters。基本上,您的代码向https://api.particle.io/v1/events/motion-detected?access_token=token_goes_here
发出一个请求,这可以通过打印urlprint(r3.url)
来验证如Alik的响应中所述,自定义头作为
headers
参数中的字典传递。在你的情况下,那将是由于这是身份验证,最干净的方法是实现自定义身份验证处理程序,该处理程序按照documentation中的描述设置此头。在
相关问题 更多 >
编程相关推荐