richard-better / pushbullet.py

A python client for http://pushbullet.com
MIT License
575 stars 110 forks source link

sms help #114

Open philwep opened 7 years ago

philwep commented 7 years ago

sending sms works flawlessly, is there anyway to check for an sms meeting x requirements within a certain timeframe, say past 5 minutes. Or make it continuously check on each sms recieved?

Ilhicas commented 6 years ago

I know this is an old question, leaving here for future readers.

I believe this requires this lib to be refactored, been checking on how to read SMS. Pushbullet allows this, but seems that its not documented, as besides ephemerals, there are other endpoints, such as permanents.

To get all sms from a given device you could do something like this with current lib:

pb = Pushbullet(api_key) some_device = pb.devices[x] device_sms_url = "https://api.pushbullet.com/v2/permanents/%s_threads"%(some_device.device_iden) messages = pb._session.get(device_sms_url).text

Json load messages or use .json() from requests to work the json response of all sms for given device.