Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Update listener example to match current API #39

Merged
merged 1 commit into from
Jun 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions example/listener_example.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
#!/usr/bin/env python

__author__ = 'Igor Maculan <[email protected]>'
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:
Expand All @@ -29,4 +32,4 @@ def main():


if __name__ == '__main__':
main()
main()