From 760782f42715b82a09cf5396e86847c5d3d87cd3 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 2 Jan 2018 00:48:41 +0100 Subject: [PATCH] Added new files --- platypush/__main__.py | 15 +++++++++++++++ platypush/message/event/ping.py | 12 ++++++++++++ platypush/pusher/__main__.py | 21 +++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 platypush/__main__.py create mode 100644 platypush/message/event/ping.py create mode 100644 platypush/pusher/__main__.py diff --git a/platypush/__main__.py b/platypush/__main__.py new file mode 100644 index 000000000..211b5fef0 --- /dev/null +++ b/platypush/__main__.py @@ -0,0 +1,15 @@ +import sys + +from . import Daemon, __version__ + +def main(args=sys.argv[1:]): + print('Starting platypush v.{}'.format(__version__)) + app = Daemon.build_from_cmdline(args) + app.start() + +if __name__ == '__main__': + main() + + +# vim:sw=4:ts=4:et: + diff --git a/platypush/message/event/ping.py b/platypush/message/event/ping.py new file mode 100644 index 000000000..dd222d9d4 --- /dev/null +++ b/platypush/message/event/ping.py @@ -0,0 +1,12 @@ +from platypush.message.event import Event, EventMatchResult + + +class PingEvent(Event): + """ Ping event """ + + def __init__(self, message=None, *args, **kwargs): + super().__init__(message=message, *args, **kwargs) + + +# vim:sw=4:ts=4:et: + diff --git a/platypush/pusher/__main__.py b/platypush/pusher/__main__.py new file mode 100644 index 000000000..0ab848943 --- /dev/null +++ b/platypush/pusher/__main__.py @@ -0,0 +1,21 @@ +import sys + +from . import Pusher + +def main(args=sys.argv[1:]): + opts = Pusher.parse_build_args(args) + + pusher = Pusher(config_file=opts.config, backend=opts.backend) + + if opts.type == 'event': + delattr(opts, 'type') + print(opts.args) + pusher.send_event(target=opts.target, type=opts.event, **opts.args) + else: + pusher.push(target=opts.target, action=opts.action, timeout=opts.timeout, **opts.args) + + +main() + +# vim:sw=4:ts=4:et: +