rest_client.py

optimised with var 'configstatus'
This commit is contained in:
av1nxsh 2021-03-02 16:16:20 +05:30 committed by GitHub
parent 218d22ed52
commit a85e656e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,9 +176,10 @@ class FtRestClient():
def ping(self): def ping(self):
"""simple ping""" """simple ping"""
if not self.show_config(): configstatus = self.show_config()
if not configstatus:
return {"status": "not_running"} return {"status": "not_running"}
elif self.show_config()['state'] == "running": elif configstatus['state'] == "running":
return {"status": "pong"} return {"status": "pong"}
else: else:
return {"status": "not_running"} return {"status": "not_running"}