Beispiel #1
0
def login():
    id=int(qq_id.get())
    pwd=qq_pwd.get()
    qq_user=qqlib.qq(id,pwd,log,conn)
    protocol=ConsoleProtocol(qq_user)
    log.info ('Python-QQ开始运行')
    protocol.pre_login()
    threads.append(qqrecv(protocol))
    threads.append(qqalive(protocol))
    threads.append(qqinput(protocol))
    for t in threads:
        t.start()
    for t in threads:
        t.join()
    log.error('程序运行结束或失败,如有异常情况请和作者联系。')
    log.info( "收到 %d 条", getnum)
    log.info("用时:%.2f 秒", (clock()-start))
    log.info("每秒:%f条", (nownum / (clock()-start)))
Beispiel #2
0
def main():
    log=qqlib.initLogging()
    nownum = 0
    lastuid = ''
    getnum = 0
    start = clock()
    conn=socket(AF_INET, SOCK_DGRAM)
    conn.settimeout(60)
    threads=[]
    if os.name == 'nt':
        qq_id=int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936")))
        pwd=getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936"))
    else:
        qq_id=int(raw_input('请输入你的QQ号码:'))
        pwd=getpass.getpass('请输入你的QQ密码:')
    qq_user=qqlib.qq(qq_id,pwd,log,conn)
    protocol=ConsoleProtocol(qq_user)
    try:
        log.info ('Python-QQ开始运行')
        protocol.pre_login()
    except Exception,ex:
        log.error(ex)