proxy.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:ZhihuSpider 作者: AlexTan-b-z 项目源码 文件源码
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"%(ipall),ipall)
    else:
        logger.warning("The number of  the IP is %s!" % str(ipNum))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号