Browse Source

Fixed some bugs in the client implementation relating to the aiohttp transition

Stan Janssen 4 years ago
parent
commit
173f44e5a4
1 changed files with 2 additions and 2 deletions
  1. 2 2
      pyopenadr/client.py

+ 2 - 2
pyopenadr/client.py

@@ -262,7 +262,7 @@ class OpenADRClient:
         url = f"{self.vtn_url}/{service}"
         async with self.client_session.post(url, data=message) as req:
             if req.status != HTTPStatus.OK:
-                raise Exception(f"Received non-OK status in request: {req.status_code}")
+                raise Exception(f"Received non-OK status in request: {req.status}")
             content = await req.read()
             if self.debug:
                 print(content.decode('utf-8'))
@@ -279,7 +279,7 @@ class OpenADRClient:
             print(f"Now responding with {result}")
         request_id = message['request_id']
         event_id = message['events'][0]['event_descriptor']['event_id']
-        self.created_event(request_id, event_id, result)
+        await self.created_event(request_id, event_id, result)
         return
 
     async def _on_report(self, message):