aboutsummaryrefslogtreecommitdiffstats
path: root/api.py
diff options
context:
space:
mode:
authorgenofire <geno+dev@fireorbit.de>2020-06-29 19:34:48 +0200
committergenofire <geno+dev@fireorbit.de>2020-06-29 19:34:48 +0200
commit091b6e525aacad1abf8d800338d242141dec11c2 (patch)
tree73137b27409b00a45c76c2bfbf4b5e9d029a4ff1 /api.py
parent1256ea7de8a093f51b116f2802871480cd646ae8 (diff)
parent044e0334d2bfb9c4b076afc562e4fb3d17c7db20 (diff)
Merge branch 'add-ci' into 'master'
Add ci See merge request sum7/ejabberd-tools!6
Diffstat (limited to 'api.py')
-rw-r--r--api.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/api.py b/api.py
index b14fa52..6b83d2b 100644
--- a/api.py
+++ b/api.py
@@ -9,6 +9,7 @@ class EjabberdApi:
"""
class to interact with the ejabberd rest/ xmlrpc api
"""
+
def __init__(self, url, login=None, api: str = "rpc"):
# api variables
self._login = login
@@ -25,7 +26,7 @@ class EjabberdApi:
@property
def _auth(self) -> (str, None):
if self._login is not None:
- return f"{self._login['user']}@{self._login['server']}", self._login['password']
+ return f"{self._login['user']}@{self._login['server']}", self._login["password"]
return None
def _rest(self, command: str, data) -> dict:
@@ -34,7 +35,7 @@ class EjabberdApi:
self.session.auth = self._auth
# post
- r = self.session.post('/'.join([self._url, command]), json=data)
+ r = self.session.post("/".join([self._url, command]), json=data)
# proceed if response is ok
if r.ok:
@@ -52,6 +53,6 @@ class EjabberdApi:
return fn(self._login, data)
return fn(data)
- except:
+ except: # noqa: E722
# this needs to be more specific
return {}