Skip to content

Commit

Permalink
Merge pull request #30 from StephanU/bugfix/20240727_enhance_error_me…
Browse files Browse the repository at this point in the history
…ssage

Enhanced the login error message.
  • Loading branch information
StephanU authored Jul 27, 2024
2 parents 78a394d + 7ed9554 commit 059acfb
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions custom_components/tsun/pyTalentMonitor/data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ def __init__(
self._session = session
self._token = None

def get_credentials(self):
"""Check whether the credentials are set."""
if not self._username or not self.password:
raise ValueError(
"Credentials not provided via command line arguments or environment variables."
)

async def login(self):
"""Log in using the given credentials."""
login_data = {"username": self._username, "password": self._password}
Expand All @@ -38,7 +31,7 @@ async def login(self):
self._token = response_data["token"]
_LOGGER.debug("Login successful - received token: %s", self._token)
else:
_LOGGER.error("Login failed. Got status code %s", response.status)
_LOGGER.error("Login failed. Token missing in response. Got status code %s", response.status)
raise AuthenticationError("Authentication failed")

async def refresh_token(self):
Expand Down

0 comments on commit 059acfb

Please sign in to comment.