def main(): queue = Message(config.Redis, config.RedisKey) weibo = Weibo(config.ChromeDriver, callback) while True: try: msg = queue.getMessage() if msg is not None: msg = msg.decode() if msg == 'debug': weibo.debug("debug") continue log.info("检测到消息,准备发送") weibo.postWeibo(msg) except Exception: queue.reAddMessage(msg) weibo.debug("exception") log.error("error: %s", traceback.format_exc()) weibo.browser.refresh() time.sleep(10)