def main(): user = raw_input('QQ:') pwd = getpass.getpass('Password: ') qq = WebQQ(user, pwd) qq.on_gotmsg = reply_qq qq.login() while 1: time.sleep(0.5) try: qq.step() except KeyboardInterrupt: print "CTRL+C met, exit!" return except Exception as e: print "Error : ", e
class MyDaemon(Daemon): def qq_init(self): user = raw_input('QQ:') pwd = getpass.getpass('Password: '******'a+') t = threading.Thread(target = webserver) t.daemon = True t.start() while 1: try: self.qq.step() except KeyboardInterrupt: print "CTRL+C met, exit!" return except Exception as e: print "Error : ", e