diff options
author | genofire <geno+dev@fireorbit.de> | 2019-12-07 16:19:36 +0100 |
---|---|---|
committer | genofire <geno+dev@fireorbit.de> | 2019-12-07 16:19:36 +0100 |
commit | ee25eb6e2382c4c0699338bba851eba13ba03eaf (patch) | |
tree | 0932107e14fb12de9192ffac2e2dadc2404516d6 | |
parent | a5a39958cc37f1415457d8361d7bcde5c1d34325 (diff) |
improve error handling + fix muc
-rwxr-xr-x | ejabberdrpc.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ejabberdrpc.py b/ejabberdrpc.py index 0e20986..179d61e 100755 --- a/ejabberdrpc.py +++ b/ejabberdrpc.py @@ -20,6 +20,7 @@ class EjabberdMetrics(): else: self._url = url self._cmd = self._rest + @property def _auth(self): if self._login is not None: @@ -29,7 +30,7 @@ class EjabberdMetrics(): def _rest(self, command, data): r = requests.post("%s/%s" % (self._url, command), auth=self._auth, json=data) - if r is not None: + if r.status_code == 200: return r.json() return {} @@ -141,6 +142,7 @@ class EjabberdMetrics(): result = self._cmd("muc_online_rooms", {"host": host}) if "rooms" in result: return len(result["rooms"]) + return len(result) def update(self): # nodes |