diff --git a/platypush/backend/pushbullet/__init__.py b/platypush/backend/pushbullet/__init__.py index ff0b696b..561117d1 100644 --- a/platypush/backend/pushbullet/__init__.py +++ b/platypush/backend/pushbullet/__init__.py @@ -5,7 +5,7 @@ import time import websockets from platypush.config import Config -from platypush.context import get_or_create_event_loop +from platypush.context import create_event_loop from platypush.message import Message from platypush.message.event.pushbullet import PushbulletEvent @@ -98,7 +98,6 @@ class PushbulletBackend(Backend): return is_duplicate def on_push(self, ws, data): - print('***** {}'.format(data)) try: # Parse the push try: @@ -152,8 +151,8 @@ class PushbulletBackend(Backend): self.on_push(self.ws, push) self.close() - loop = get_or_create_event_loop() + loop = create_event_loop() loop.run_until_complete(pushbullet_client()) loop.run_forever() diff --git a/platypush/context/__init__.py b/platypush/context/__init__.py index 6b46449f..8971ad38 100644 --- a/platypush/context/__init__.py +++ b/platypush/context/__init__.py @@ -114,6 +114,11 @@ def register_plugin(name, plugin, **kwargs): """ Registers a plugin instance by name """ global plugins +def create_event_loop(): + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + return loop + def get_or_create_event_loop(): try: loop = asyncio.get_event_loop()