diff --git a/shared/alerts.py b/shared/alerts.py index e2b0a10..9437334 100644 --- a/shared/alerts.py +++ b/shared/alerts.py @@ -1,6 +1,10 @@ import time -import asyncio -import inspect +try: + import asyncio + import inspect + ASYNCIO = True +except ImportError: + ASYNCIO = False class AlertManager: def __init__(self): @@ -12,7 +16,7 @@ class AlertManager: def call_on_alert_callback(self, alert): if self.on_alert_callback: - if inspect.iscoroutinefunction(self.on_alert_callback): + if ASYNCIO and inspect.iscoroutinefunction(self.on_alert_callback): # Schedule coroutine on the running loop without blocking try: loop = asyncio.get_running_loop()