def pushLink(args): p = PushBullet(args.api_key) link = p.pushLink(args.device, args.title, args.url) if args.json: print(json.dumps(link)) return if args.device and args.device[0] == '#': print("Link broadcast to channel %s" % (args.device)) elif not args.device: print("Link %s sent to all devices" % (link["iden"])) else: print("Link %s sent to %s" % (link["iden"], link["target_device_iden"]))
from pushbullet.pushbullet import PushBullet apiKey = "o.4Om3sn1YmS2wAXKDQG7wakv3Z7yDE5B4" p = PushBullet(apiKey) devices = p.getDevices() # print(devices) # p.pushNote(devices[3]["iden"], 'Hello mcfly', 'Test body') p.pushLink(devices[3]["iden"], "Google", "http://www.google.com")