2017-11-03 04:08:47 +01:00
|
|
|
import sys
|
2017-12-11 03:53:26 +01:00
|
|
|
import logging
|
2017-12-13 03:37:28 +01:00
|
|
|
|
2017-12-18 01:10:51 +01:00
|
|
|
from platypush.config import Config
|
2017-12-13 04:21:26 +01:00
|
|
|
from platypush.message.response import Response
|
2017-11-03 04:08:47 +01:00
|
|
|
|
2018-06-06 20:09:18 +02:00
|
|
|
|
2017-10-31 09:20:35 +01:00
|
|
|
class Plugin(object):
|
2017-12-18 01:10:51 +01:00
|
|
|
""" Base plugin class """
|
2017-11-03 15:06:29 +01:00
|
|
|
|
2017-12-18 01:10:51 +01:00
|
|
|
def __init__(self, **kwargs):
|
2018-06-06 20:09:18 +02:00
|
|
|
self.logger = logging.getLogger(__name__)
|
|
|
|
if 'logging' in kwargs:
|
|
|
|
self.logger.setLevel(getattr(logging, kwargs['logging'].upper()))
|
2017-11-03 04:08:47 +01:00
|
|
|
|
2017-11-04 12:28:15 +01:00
|
|
|
def run(self, method, *args, **kwargs):
|
2017-12-13 04:14:46 +01:00
|
|
|
return getattr(self, method)(*args, **kwargs)
|
2017-12-13 03:37:28 +01:00
|
|
|
|
2017-10-31 09:20:35 +01:00
|
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|
|
|
|
|