Skip to content

Commit

Permalink
Ignore UnicodeDecodeError on reading content (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaskivskyi authored Oct 31, 2023
1 parent 9cb81eb commit 37d4e9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion asusrouter/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ async def _make_post_request(
resp_headers = response.headers

# Read the response
resp_content = await response.text()
try:
resp_content = await response.text()
except UnicodeDecodeError:
_LOGGER.debug("Cannot decode response. Will ignore errors")
resp_content = await response.text(errors="ignore")

# Return the response
return (resp_status, resp_headers, resp_content)
Expand Down

0 comments on commit 37d4e9b

Please sign in to comment.