Exemple #1
0
def __test():
    """
    具体的测试
    """
    def print_result(c):
        while True:
            if c.is_avaliable():
                c.print_progress()
            time.sleep(3)
            
    from config import MyConfig
    MyConfig.do_default()
    c = Crawler(MyConfig)
    threading.Thread(group = None, target=print_result, args=(c,)).start()
    c.start()
Exemple #2
0
def main():
    myconfig = get_config()

    if myconfig == False:
        # 解析参数出错,直接退出
        return

    if myconfig == None:
        print "do not have any configuration, then switch testself truns on!"
        myconfig = MyConfig()
        myconfig.testself = True

    if myconfig.testself:
        # 如果 testself开关 trun on
        # 则 其它设置默认无效
        myconfig.do_default()
    else:
        myconfig.check_config()
    myconfig.show_config()
    crawler = Crawler(myconfig)
    progress_info(crawler)
    crawler.start()