(rconn)
把有效的IP存入	REDIS数据库
把有效的IP存入	REDIS数据库
把有效的IP存入 REDIS数据库
def initIPPOOLS(rconn):
    """把有效的IP存入	REDIS数据库"""

    ipNum=len(rconn.keys('IP*'))
    if ipNum<IPPOOLNUM:
        IPPOOLS=GetIPPOOLS(IPPOOLNUM)
        for ipall in IPPOOLS:
            try:
                ip=ipall.split(':')[0]
                port=ipall.split(':')[1]
                telnetlib.Telnet(ip,port=port,timeout=2) #检验代理ip是否有效
            except:
                logger.warning("The ip is not available !( IP:%s )" % ipall)
            else:
                logger.warning("Get ip Success!( IP:%s )" % ipall)
                rconn.set("IP:%s:10"%(ipall),ipall)     #10 is status
    else:
        logger.warning("The number of  the IP is %s!" % str(ipNum))
def initIPPOOLS ( rconn ) : ipNum = len ( rconn . keys ( 'IP*' ) ) if ipNum < IPPOOLNUM : IPPOOLS = GetIPPOOLS ( IPPOOLNUM ) for ipall in IPPOOLS : try : ip = ipall . split ( ':' ) [ 0 ] port = ipall . split ( ':' ) [ 1 ] telnetlib . Telnet ( ip , port = port , timeout = 2 ) #检验代理ip是否有效 except : logger . warning ( "The ip is not available !( IP:%s )" % ipall ) else : logger . warning ( "Get ip Success!( IP:%s )" % ipall ) rconn . set ( "IP:%s:10" % ( ipall ) , ipall ) #10 is status else : logger . warning ( "The number of  the IP is %s!" % str ( ipNum ) )