Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl authored Apr 11, 2022
1 parent 9031763 commit 3c3f24a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pyoverkiz/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async def login(
await self.register_event_listener()
else:
# Call a simple endpoint to verify if our token is correct
await self.get_api_version()
await self.get_gateways()

return True

Expand Down Expand Up @@ -254,8 +254,7 @@ async def refresh_token(self) -> None:
return

if not self._refresh_token:
raise ValueError(
"No refresh token provided. Login method must be used.")
raise ValueError("No refresh token provided. Login method must be used.")

# &grant_type=refresh_token&refresh_token=REFRESH_TOKEN
# Request access token
Expand Down Expand Up @@ -311,8 +310,7 @@ async def cozytouch_login(self) -> str:
# {'error': 'invalid_grant',
# 'error_description': 'Provided Authorization Grant is invalid.'}
if "error" in token and token["error"] == "invalid_grant":
raise CozyTouchBadCredentialsException(
token["error_description"])
raise CozyTouchBadCredentialsException(token["error_description"])

if "token_type" not in token:
raise CozyTouchServiceException("No CozyTouch token provided.")
Expand Down Expand Up @@ -489,8 +487,7 @@ async def get_execution_history(self) -> list[HistoryExecution]:
List execution history
"""
response = await self.__get("history/executions")
execution_history = [HistoryExecution(
**h) for h in humps.decamelize(response)]
execution_history = [HistoryExecution(**h) for h in humps.decamelize(response)]

return execution_history

Expand Down Expand Up @@ -806,8 +803,7 @@ async def check_response(response: ClientResponse) -> None:
except JSONDecodeError as error:
result = await response.text()
if "Server is down for maintenance" in result:
raise MaintenanceException(
"Server is down for maintenance") from error
raise MaintenanceException("Server is down for maintenance") from error
raise Exception(
f"Unknown error while requesting {response.url}. {response.status} - {result}"
) from error
Expand Down

0 comments on commit 3c3f24a

Please sign in to comment.