Skip to content

Commit 73c9b2b

Browse files
committed
Add exception for invalid credentials
1 parent 2ba47c1 commit 73c9b2b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

glances_api/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ async def get_data(self, endpoint):
4747
except httpx.ConnectError:
4848
raise exceptions.GlancesApiConnectionError(f"Connection to {url} failed")
4949

50+
if response.status_code == httpx.codes.UNAUTHORIZED:
51+
raise exceptions.GlancesApiAuthorizationError(
52+
"Please check your credentials"
53+
)
54+
5055
if response.status_code == httpx.codes.OK:
5156
try:
5257
_LOGGER.debug(response.json())

0 commit comments

Comments
 (0)