Browse Source

Explicitly log the HTTP status on errors

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen 4 years ago
parent
commit
18b31060f5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      openleadr/client.py

+ 2 - 2
openleadr/client.py

@@ -661,8 +661,8 @@ class OpenADRClient:
             async with self.client_session.post(url, data=message) as req:
             async with self.client_session.post(url, data=message) as req:
                 content = await req.read()
                 content = await req.read()
                 if req.status != HTTPStatus.OK:
                 if req.status != HTTPStatus.OK:
-                    logger.warning(f"Non-OK status when performing a request to {url} with data "
-                                   f"{message}: {req.status} {content.decode('utf-8')}")
+                    logger.warning(f"Non-OK status {req.status} when performing a request to {url} "
+                                   f"with data {message}: {req.status} {content.decode('utf-8')}")
                     return None, {}
                     return None, {}
                 logger.debug(content.decode('utf-8'))
                 logger.debug(content.decode('utf-8'))
         except aiohttp.client_exceptions.ClientConnectorError as err:
         except aiohttp.client_exceptions.ClientConnectorError as err: