I want to use Pushbullet
to send pushes from my phone to an application (which will then display it). This application is a service written in Python.
The basic reception of the realtime stream works:
import websocket
ws = websocket.create_connection("wss://stream.pushbullet.com/websocket/MYKEY")
while True:
result = ws.recv()
print"Received '%s'" % result
When pushing something to "All Devices", I get the expected output:
Received '{"type": "nop"}'
Received '{"type": "nop"}'
Received '{"type": "tickle", "subtype": "push"}'
Received '{"type": "nop"}'
Received '{"type": "tickle", "subtype": "push"}'
What I receive does not contain any data, the type is 'tickle
', and the documentation says that
When you receive a tickle message, it means that a resource of the type subtype has changed.
and to query the details on the server. The call which is mentioned there (GET https://api.pushbullet.com/v2/pushes?modified_after=1399008037.849
) is not authenticated, so how to actually make the call?
Alternatively, I wanted to create a "device" for my application and send the pushes to it directly. But I cannot find any place in the docs where the process of impersonating a device would be described?
I gave a try to a GET
with the Authorization
header and it worked:
# 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
)
Since target_device_iden
is sent with the push details when the push is directed to a specific device, my guess is that there is no "impersonation" (per the second part of my question): every device gets the whole feed and selects the events which were specifically directed to it (or mirrored ones)