2020-02-07 18:18:17 +03:00

24 lines
732 B
Python

from requests import get
class Platform:
def __init__(self, *args, **kwargs):
# parse the user's options from the config entries
for key, value in kwargs.items():
self.__dict__[key] = value
def process(self):
try:
value = get(self.resource)
except Exception:
icon_class = "theme-failure-text"
if 599 >= value.status_code >= 400:
icon_class = "theme-failure-text"
if 399 >= value.status_code >= 300:
icon_class = "theme-warning-text"
if 299 >= value.status_code >= 100:
icon_class = "theme-success-text"
return f"<i class='material-icons right {icon_class}'>fiber_manual_record </i>"