diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2023-09-27 18:30:05 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2023-09-27 18:31:57 +0300 |
| commit | 5e21128689f909309064025ace4526a330f0e58d (patch) | |
| tree | ba49f30021ce3e8b1b387fe0aa2141f3dace609d /app/PluginManager.py | |
| parent | da9b89d089482354bce0fc95b66f30fd078405b1 (diff) | |
Specialize EmailAlerter to use SendGrid API
Diffstat (limited to 'app/PluginManager.py')
| -rw-r--r-- | app/PluginManager.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/PluginManager.py b/app/PluginManager.py index fdc81a9..b19d038 100644 --- a/app/PluginManager.py +++ b/app/PluginManager.py @@ -7,10 +7,10 @@ from types import ModuleType from typing import Any from app.Item import Item from app.PluginInterface import Params, PluginInterface -from app.AggroConfig import AggroConfig, AggroConfigEmailAlerter +from app.AggroConfig import AggroConfig, AggroConfigSendGridAlerter from app.utils import get_config from app.MemoryState import memory_state -from app.EmailAlerter import EmailAlerter +from app.SendGridAlerter import SendGridAlerter class PluginManager: @@ -19,8 +19,10 @@ class PluginManager: self.plugin_instances: dict[str, PluginInterface] = {} self.config = config self.scheduled_plugin_ids: list[str] = [] - if self.config.email_alerter: - self.email_alerter = EmailAlerter.from_config(self.config.email_alerter) + if self.config.sendgrid_alerter: + self.sendgrid_alerter = SendGridAlerter.from_config( + self.config.sendgrid_alerter + ) def load_plugin(self, plugin_name: str) -> None: module: ModuleType = importlib.import_module(f"plugins.{plugin_name}") @@ -53,8 +55,8 @@ class PluginManager: except: exc = traceback.format_exc() print(exc, file=sys.stderr) - if self.email_alerter: - self.email_alerter.send_alert(exc) + if self.sendgrid_alerter: + self.sendgrid_alerter.send_alert(exc) def build_plugin_instances(self): for id in self.config.plugins: |
