From 87051ae5aa1434ded2ed05646fa56576c31f32a2 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Sat, 18 Apr 2015 15:52:39 -0400 Subject: [PATCH] Update listener example to match current API set file as executable as well --- example/listener_example.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) mode change 100644 => 100755 example/listener_example.py diff --git a/example/listener_example.py b/example/listener_example.py old mode 100644 new mode 100755 index 7c20af4..ff7e08c --- a/example/listener_example.py +++ b/example/listener_example.py @@ -1,25 +1,28 @@ +#!/usr/bin/env python + __author__ = 'Igor Maculan ' import logging from pushbullet import Listener +from pushbullet import Pushbullet logging.basicConfig(level=logging.DEBUG) API_KEY = '' # YOUR API KEY -DEVICE_ID = '' # id of device if None the listener listen all pushes HTTP_PROXY_HOST = None HTTP_PROXY_PORT = None -def on_link(lnk): - print ('received link:' + lnk['url']) +def on_push(data): + print('Received data:\n{}'.format(data)) def main(): - s = Listener(API_KEY, - device_id=DEVICE_ID, - on_link=on_link, + pb = Pushbullet(API_KEY) + + s = Listener(account=pb, + on_push=on_push, http_proxy_host=HTTP_PROXY_HOST, http_proxy_port=HTTP_PROXY_PORT) try: @@ -29,4 +32,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main()