forked from platypush/platypush
Supporting body both as dict and str
This commit is contained in:
parent
99a93012ce
commit
bdcc6bcf1c
1 changed files with 14 additions and 8 deletions
|
@ -69,15 +69,21 @@ def _init_plugin(plugin, reload=False):
|
|||
|
||||
|
||||
def _exec_func(body, retry=True):
|
||||
args = {}
|
||||
logging.info('Received push addressed to me: {}'.format(body))
|
||||
|
||||
if 'plugin' not in body:
|
||||
logging.warn('No plugin specified')
|
||||
return
|
||||
|
||||
plugin_name = body['plugin']
|
||||
|
||||
if 'args' in body:
|
||||
args = json.loads(body['args']) \
|
||||
if isinstance(body['args'], str) \
|
||||
else body['args']
|
||||
|
||||
try:
|
||||
logging.info('Received push addressed to me: {}'.format(body))
|
||||
args = json.loads(body['args']) if 'args' in body else {}
|
||||
if 'plugin' not in body:
|
||||
logging.warn('No plugin specified')
|
||||
return
|
||||
|
||||
plugin_name = body['plugin']
|
||||
|
||||
try:
|
||||
plugin = _init_plugin(plugin_name)
|
||||
except RuntimeError as e: # Module/class not found
|
||||
|
|
Loading…
Reference in a new issue