This commit is contained in:
spla 2022-08-19 09:24:45 +02:00
pare 5e8e9064bb
commit 0e854876ad

Veure arxiu

@ -182,33 +182,38 @@ class Ejabberd:
response = self.__api_request(endpoint, data)
i = 0
while i < len(response.json()):
if len(response.json()) > 0:
temp_dict['connection'] = response.json()[i]['connection']
temp_dict['ip'] = response.json()[i]['ip']
temp_dict['port'] = response.json()[i]['port']
temp_dict['priority'] = response.json()[i]['priority']
temp_dict['node'] = response.json()[i]['node']
temp_dict['uptime'] = response.json()[i]['uptime']
temp_dict['status'] = response.json()[i]['status']
temp_dict['resource'] = response.json()[i]['resource']
temp_dict['statustext'] = response.json()[i]['statustext']
i = 0
while i < len(response.json()):
if len(sessions_dict) > 0:
temp_dict['connection'] = response.json()[i]['connection']
temp_dict['ip'] = response.json()[i]['ip']
temp_dict['port'] = response.json()[i]['port']
temp_dict['priority'] = response.json()[i]['priority']
temp_dict['node'] = response.json()[i]['node']
temp_dict['uptime'] = response.json()[i]['uptime']
temp_dict['status'] = response.json()[i]['status']
temp_dict['resource'] = response.json()[i]['resource']
temp_dict['statustext'] = response.json()[i]['statustext']
ds = [temp_dict, sessions_dict]
sessions_temp = {}
for k in temp_dict.keys():
sessions_temp[k] = tuple(sessions_temp[k] for sessions_temp in ds)
if len(sessions_dict) > 0:
else:
ds = [temp_dict, sessions_dict]
sessions_temp = {}
for k in temp_dict.keys():
sessions_temp[k] = tuple(sessions_temp[k] for sessions_temp in ds)
sessions_dict = temp_dict.copy()
else:
sessions_temp = sessions_dict.copy()
sessions_dict = temp_dict.copy()
i += 1
sessions_temp = sessions_dict.copy()
i += 1
else:
sessions_temp = sessions_dict.copy()
sessions = self.__json_allow_dict_attrs(sessions_temp)