From c63ecf77818cb47d5374cfacb8aa236357c2ab93 Mon Sep 17 00:00:00 2001 From: clerie Date: Thu, 6 Jan 2022 23:58:59 +0100 Subject: [PATCH] Fix GetAccountResp data parsing --- mitel_ommclient2/client.py | 5 +++-- mitel_ommclient2/messages/getaccount.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mitel_ommclient2/client.py b/mitel_ommclient2/client.py index b36bc7b..897ca96 100644 --- a/mitel_ommclient2/client.py +++ b/mitel_ommclient2/client.py @@ -44,9 +44,10 @@ class OMMClient2: :param id: User id """ - r = self.session.request(message.GetAccount(id)) + r = self.session.request(messages.GetAccount(id)) r.raise_on_error() - + if r.account is None: + return None return r.account[0] def ping(self): diff --git a/mitel_ommclient2/messages/getaccount.py b/mitel_ommclient2/messages/getaccount.py index fb0b949..9dc6e6f 100644 --- a/mitel_ommclient2/messages/getaccount.py +++ b/mitel_ommclient2/messages/getaccount.py @@ -24,4 +24,4 @@ class GetAccount(Request): class GetAccountResp(Response): @property def account(self): - return self.attrs.get("account") + return self.childs.get("account")