Skip to content

Commit

Permalink
improve debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
zweckj committed Nov 23, 2024
1 parent 222e006 commit d82edfe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pylamarzocco/client_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ async def _async_get_access_token(self) -> str:
"client_id": DEFAULT_CLIENT_ID,
"client_secret": DEFAULT_CLIENT_SECRET,
}
_LOGGER.debug("Getting new access token, data: %s", data)
return await self.__async_get_token(data)

async def _async_get_refresh_token(self) -> str:
Expand All @@ -81,6 +82,7 @@ async def _async_get_refresh_token(self) -> str:
"client_id": DEFAULT_CLIENT_ID,
"client_secret": DEFAULT_CLIENT_SECRET,
}
_LOGGER.debug("Refreshing access token, data: %s", data)
return await self.__async_get_token(data)

async def __async_get_token(self, data: dict[str, Any]) -> str:
Expand All @@ -100,6 +102,7 @@ async def __async_get_token(self, data: dict[str, Any]) -> str:
refresh_token=json_response["refresh_token"],
expires_in=time.time() + json_response["expires_in"],
)
_LOGGER.debug("Got new access token: %s", json_response)
return json_response["access_token"]

if response.status_code == 401:
Expand Down Expand Up @@ -151,7 +154,9 @@ async def _rest_api_call(

# ensure status code indicates success
if response.is_success:
return response.json()["data"]
json_response = response.json()
_LOGGER.debug("Request to %s successful", json_response)
return json_response["data"]

raise RequestNotSuccessful(
f"Request to endpoint {response.url} failed with status code {response.status_code}"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pylamarzocco"
version = "1.2.10"
version = "1.2.11"
license = { text = "MIT License" }
description = "A Python implementation of the new La Marzocco API"
readme = "README.md"
Expand Down

0 comments on commit d82edfe

Please sign in to comment.