move url to private class level

This commit is contained in:
Matthias 2018-07-14 13:29:34 +02:00
parent 120fc29643
commit 1284627219

View File

@ -26,6 +26,7 @@ class Webhook(RPC):
super().__init__(freqtrade) super().__init__(freqtrade)
self._config = freqtrade.config self._config = freqtrade.config
self._url = self._config['webhook']['url']
def cleanup(self) -> None: def cleanup(self) -> None:
""" """
@ -57,10 +58,9 @@ class Webhook(RPC):
"Exception: %s", exc) "Exception: %s", exc)
def _send_msg(self, payload: dict) -> None: def _send_msg(self, payload: dict) -> None:
"""does the actual call to the webhook""" """do the actual call to the webhook"""
try: try:
url = self._config['webhook']['url'] post(self._url, data=payload)
post(url, data=payload)
except RequestException as exc: except RequestException as exc:
logger.warning("Could not call webhook url. Exception: %s", exc) logger.warning("Could not call webhook url. Exception: %s", exc)