Added new files

This commit is contained in:
Fabio Manganiello 2018-01-02 00:48:41 +01:00
parent 5a92c0ac3b
commit 760782f427
3 changed files with 48 additions and 0 deletions

15
platypush/__main__.py Normal file
View File

@ -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:

View File

@ -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:

View File

@ -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: