def run(self): if internet(): self.output = { "color": self.color, "full_text": self.format_online, } else: self.output = { "color": self.color_offline, "full_text": self.format_offline, }
def update_thread(self): if internet(): self.interval = self.online_interval else: self.interval = self.offline_interval try: self.check_weather() while True: with self.condition: self.condition.wait(self.interval) self.check_weather() except Exception: msg = 'Exception in {thread} at {time}, module {name}'.format( thread=threading.current_thread().name, time=time.strftime('%c'), name=self.__class__.__name__, ) self.logger.error(msg, exc_info=True)
def unread(self): if internet(): conn = self.get_connection() self.last = len(conn.search(None, "UnSeen")[1][0].split()) return self.last