Skip to content

Commit

Permalink
Merge pull request #76 from chemelli74/chemelli74-logging
Browse files Browse the repository at this point in the history
fix: improve logging
  • Loading branch information
chemelli74 authored Jan 20, 2024
2 parents 16614e7 + 782537e commit c9ea74f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/aiovodafone/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ async def _post_sercomm_page(
"""Post html page and process reply."""

reply = await self._post_page_result(page, payload, timeout)
_LOGGER.debug("POST raw reply (%s): %s", page, await reply.text())
reply_json = await reply.json(content_type="text/html")
_LOGGER.debug("POST reply (%s): %s", page, reply_json)
_LOGGER.debug("POST json reply (%s): %s", page, reply_json)
return reply_json

async def _find_login_url(self) -> str:
Expand Down Expand Up @@ -543,6 +544,9 @@ async def restart_connection(self, connection_type: str) -> None:
try:
await self._post_sercomm_page("/data/statussupportrestart.json", payload)
except aiohttp.ClientResponseError as ex:
_LOGGER.debug(
'Client response error for "restart_connection" is: %s', ex.message
)
# Some models dump a text reply with wrong HTML headers as reply to a reconnection request
if not ex.message.startswith("Invalid header token"):
raise ex
Expand Down

0 comments on commit c9ea74f

Please # to comment.