Added new files
This commit is contained in:
parent
5a92c0ac3b
commit
760782f427
3 changed files with 48 additions and 0 deletions
15
platypush/__main__.py
Normal file
15
platypush/__main__.py
Normal 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:
|
||||||
|
|
12
platypush/message/event/ping.py
Normal file
12
platypush/message/event/ping.py
Normal 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:
|
||||||
|
|
21
platypush/pusher/__main__.py
Normal file
21
platypush/pusher/__main__.py
Normal 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:
|
||||||
|
|
Loading…
Reference in a new issue