def task(): global service_status_list global rebooted try: status = MojangAPI.get_api_status() service_status_change = False status_changed_services = {} if rebooted: update_profile(status) rebooted = False else: for service in status.keys(): if service_status_list[service] != status[service]: service_status_change = True if is_status_should_notify(status[service], service): status_changed_services[service] = ServiceState( status=status[service], last_changed_time=datetime.utcnow()) if service_status_change: update_profile(status) tweet_services_status(status_changed_services) service_status_list = status except Exception as e: print(e) pass
def test_get_api_status(self): statuses = MojangAPI.get_api_status() self.assertEqual(bool(statuses.get("minecraft.net")), True)