File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -61,22 +61,22 @@ async def get_data(self, endpoint: str) -> None:
6161 raise exceptions .GlancesApiAuthorizationError (
6262 "Please check your credentials"
6363 )
64- if response .status_code == httpx .codes .BAD_REQUEST :
64+
65+ if response .status_code != httpx .codes .OK :
6566 raise exceptions .GlancesApiNoDataAvailable (
6667 f"endpoint: '{ endpoint } ' is not valid"
6768 )
68- if response .status_code == httpx .codes .OK :
69- try :
70- _LOGGER .debug (response .json ())
71- if endpoint == "all" :
72- self .data = response .json ()
73- elif endpoint == "pluginslist" :
74- self .plugins = response .json ()
75- except TypeError :
76- _LOGGER .error ("Can not load data from Glances" )
77- raise exceptions .GlancesApiConnectionError (
78- "Unable to get the data from Glances"
79- )
69+ try :
70+ _LOGGER .debug (response .json ())
71+ if endpoint == "all" :
72+ self .data = response .json ()
73+ elif endpoint == "pluginslist" :
74+ self .plugins = response .json ()
75+ except TypeError :
76+ _LOGGER .error ("Can not load data from Glances" )
77+ raise exceptions .GlancesApiConnectionError (
78+ "Unable to get the data from Glances"
79+ )
8080
8181 async def get_metrics (self , element : str ) -> None :
8282 """Get all the metrics for a monitored element."""
You can’t perform that action at this time.
0 commit comments