mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pyln: add ability to subscribe to all notifications.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
17
tests/plugins/all_notifications.py
Executable file
17
tests/plugins/all_notifications.py
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
from pyln.client import Plugin
|
||||
import sys
|
||||
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.subscribe("*")
|
||||
def on_any_notification(request, **kwargs):
|
||||
plugin.log("notification {}: {}".format(request.method, kwargs))
|
||||
if request.method == 'shutdown':
|
||||
# A plugin which subscribes to shutdown is expected to exit itself.
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user