如何查询设备的推送?
How to query the pushes for a device?
我想使用 Pushbullet
将来自我的 phone 的推送发送到应用程序(然后将显示它)。此应用程序是用 Python.
编写的服务
实时流的基本接收工作:
import websocket
ws = websocket.create_connection("wss://stream.pushbullet.com/websocket/MYKEY")
while True:
result = ws.recv()
print"Received '%s'" % result
将内容推送到 "All Devices" 时,我得到了预期的输出:
Received '{"type": "nop"}'
Received '{"type": "nop"}'
Received '{"type": "tickle", "subtype": "push"}'
Received '{"type": "nop"}'
Received '{"type": "tickle", "subtype": "push"}'
我收到的不包含任何数据,类型是'tickle
',the documentation says那个
When you receive a tickle message, it means that a resource of the
type subtype has changed.
并在服务器上查询详细信息。那里提到的调用 (GET https://api.pushbullet.com/v2/pushes?modified_after=1399008037.849
) 未经过身份验证,那么如何实际拨打电话?
或者,我想为我的应用程序创建一个 "device" 并直接向它发送推送。但是我在文档中找不到描述模拟设备过程的地方?
我用 Authorization
header 尝试了 GET
并且成功了:
# ts is the timestamp one wants to check from on
ts = 0
headers = {'Authorization': 'Bearer MYKEY'}
r = requests.get(
'https://api.pushbullet.com/v2/pushes?modified_after={ts}'.format(ts=ts),
headers=headers
)
由于当推送被定向到特定设备时 target_device_iden
与推送详细信息一起发送,我的猜测是没有 "impersonation"(根据我问题的第二部分):每个设备获取整个提要并选择专门针对它的事件(或镜像事件)
我想使用 Pushbullet
将来自我的 phone 的推送发送到应用程序(然后将显示它)。此应用程序是用 Python.
实时流的基本接收工作:
import websocket
ws = websocket.create_connection("wss://stream.pushbullet.com/websocket/MYKEY")
while True:
result = ws.recv()
print"Received '%s'" % result
将内容推送到 "All Devices" 时,我得到了预期的输出:
Received '{"type": "nop"}'
Received '{"type": "nop"}'
Received '{"type": "tickle", "subtype": "push"}'
Received '{"type": "nop"}'
Received '{"type": "tickle", "subtype": "push"}'
我收到的不包含任何数据,类型是'tickle
',the documentation says那个
When you receive a tickle message, it means that a resource of the type subtype has changed.
并在服务器上查询详细信息。那里提到的调用 (GET https://api.pushbullet.com/v2/pushes?modified_after=1399008037.849
) 未经过身份验证,那么如何实际拨打电话?
或者,我想为我的应用程序创建一个 "device" 并直接向它发送推送。但是我在文档中找不到描述模拟设备过程的地方?
我用 Authorization
header 尝试了 GET
并且成功了:
# ts is the timestamp one wants to check from on
ts = 0
headers = {'Authorization': 'Bearer MYKEY'}
r = requests.get(
'https://api.pushbullet.com/v2/pushes?modified_after={ts}'.format(ts=ts),
headers=headers
)
由于当推送被定向到特定设备时 target_device_iden
与推送详细信息一起发送,我的猜测是没有 "impersonation"(根据我问题的第二部分):每个设备获取整个提要并选择专门针对它的事件(或镜像事件)