def get_server_info(self): if self.is_online: s = ServerInfo() s.send(self.port.port) if not s.server_info and timezone.now() >= self.set_online_at + timedelta(seconds=10): # assume there is something wrong with the server self.set_offline() info_dict = s.server_info info_dict['password'] = s.password self.server_info = info_dict else: self.server_info = '' self.save()
def get_server_info(self): if self.is_online: s = ServerInfo() s.send(self.port.port) if not s.server_info and timezone.now( ) >= self.set_online_at + timedelta( seconds=10 ): # assume there is something wrong with the server self.set_offline() info_dict = s.server_info info_dict['password'] = s.password self.server_info = info_dict else: self.server_info = '' self.save()
def get_info(self): if self.is_online and self.check_online(): s = ServerInfo(self) return s.get_data() return None