Skip to content

Commit

Permalink
Add better handling
Browse files Browse the repository at this point in the history
  • Loading branch information
CoMPaTech committed Oct 17, 2023
1 parent 89cd308 commit 6e1ef07
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/stromer/stromer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ async def stromer_get_code(self):
res = await self._websession.get(url)
try:
cookie = res.headers.get("Set-Cookie")
pattern = "=(.*?);"
csrftoken = re.search(pattern, cookie).group(1)
except Exception as e:
LOGGER.error("Stromer error: api call failed: {}".format(e))
LOGGER.error(f"Stromer error: api call failed: {e} with content {res}")
raise ApiError

pattern = "=(.*?);"
csrftoken = re.search(pattern, cookie).group(1)

qs = urlencode(
{
"client_id": self._client_id,
Expand Down

0 comments on commit 6e1ef07

Please sign in to comment.