use dict comprehension

This commit is contained in:
Matthias 2018-07-12 21:54:31 +02:00
parent 6336d8a0e2
commit 120fc29643

View File

@ -49,10 +49,8 @@ class Webhook(RPC):
if not valuedict: if not valuedict:
logger.info("Message type %s not configured for webhooks", msg['type']) logger.info("Message type %s not configured for webhooks", msg['type'])
return return
payload = {}
for k in valuedict:
payload[k] = valuedict[k].format(**msg)
payload = {key: value.format(**msg) for (key, value) in valuedict.items()}
self._send_msg(payload) self._send_msg(payload)
except KeyError as exc: except KeyError as exc:
logger.exception("Problem calling Webhook. Please check your webhook configuration. " logger.exception("Problem calling Webhook. Please check your webhook configuration. "