def get(self, request): _saltapi = SaltAPI(url=SALT_API_URL, username=SALT_API_USERNAME, password=SALT_API_PASSWORD) _ret = _saltapi.check_alive('*') for host, is_alive in _ret.items(): SaltMinion.objects.filter(hostname=host).update( is_alive=is_alive, last_alive_time=timezone.now(), u_time=timezone.now()) return Response('success')