basic_monitor.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. from abc import ABC, abstractmethod
  2. from typing import Optional
  3. from client.FeiShuClient import FeiShuService
  4. from resource.enums.resource import Resource
  5. class BasicMonitor(ABC):
  6. resource: Optional[Resource] = None
  7. _monitors = []
  8. def __init__(self):
  9. self.access_key_id = "LTAI5tRwjztCCwQNBB6nW1dY"
  10. self.access_key_secret = "NaTnMxrGEJh64tLly7Kb5tr166Xpos"
  11. self.fei_shu_spread_sheet_token = "XzQGsheQzhk74rtknKacClASnTc"
  12. self.fei_shu_service = FeiShuService()
  13. def __init_subclass__(cls, **kwargs):
  14. super().__init_subclass__(**kwargs)
  15. if cls != BasicMonitor:
  16. cls._monitors.append(cls)
  17. @classmethod
  18. def get_monitors(cls):
  19. return cls._monitors
  20. def fei_shu_tenant_access_token(self, app_id: str = "cli_a89702999f3c900b", app_secret: str = "47ewnaxRqJAvHYdUR8idHgfzfeqAu0Pz") -> str:
  21. tenant_access_token = self.fei_shu_service.get_tenant_access_token(app_id, app_secret)
  22. return tenant_access_token
  23. @abstractmethod
  24. def run(self):
  25. raise NotImplementedError("该方法没有被实现")