From c74ee7c6cb195c06128a63d2a8c907a224b4f341 Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Thu, 27 Feb 2025 21:52:15 +0100 Subject: [PATCH] Add requests to requirements.txt, assert that actions is not None when creating the buttons in the ui, move imports to the top in dashboard.system --- dashboard/system.py | 12 ++++++------ dashboard/ui.py | 1 + requirements.txt | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dashboard/system.py b/dashboard/system.py index 9ed6c3e..f9ae0f5 100644 --- a/dashboard/system.py +++ b/dashboard/system.py @@ -10,9 +10,15 @@ import time from enum import Enum from typing import List +import requests, urllib3 + from .mixins import PingableMixin, WakeOnLanMixin +# don't need the warning, bc. ssl verification needs to be disabled explicitly +urllib3.disable_warnings(category=urllib3.connectionpool.InsecureRequestWarning) + + # base classes and types and stuff @@ -110,12 +116,6 @@ class PingableWOLSystem(WakeOnLanMixin, PingableSystem): # HTTP Server System -import requests, urllib3 - -# don't need the warning, bc. ssl verification needs to be disabled explicitly -urllib3.disable_warnings(category=urllib3.connectionpool.InsecureRequestWarning) - - class HTTPServer(System): def __init__(self, name, description, url: str, expected_status_code: int = 200, allow_self_signed_cert: bool = False): diff --git a/dashboard/ui.py b/dashboard/ui.py index e870a64..b332edd 100644 --- a/dashboard/ui.py +++ b/dashboard/ui.py @@ -39,6 +39,7 @@ def init_ui( if t.state_verbose != "": html.pre(t.state_verbose).classes("opacity-50 text-xs text-wrap") actions = t.get_actions() + assert actions != None if len(actions) > 0: if t.description != "" or t.state_verbose != "": ui.separator().style("margin-top: auto;") diff --git a/requirements.txt b/requirements.txt index cdf2536..94b3c8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ nicegui~=2.11.1 +requests