コード例 #1
0
ファイル: main.py プロジェクト: weihaigang/Proxypool
 def get(self, cycle, *a):
     """
     定时获取代理
     """
     getter = Crawler()
     while True:
         info('[调度系统] 开始抓取代理')
         getter.run()
         if config["crawl"]["checkmax"]:
             if len(DB().getall()) >= config["crawl"]["maxvalue"]:
                 info("[调度系统] 代理池已达上限,停止抓取代理")
                 while len(DB().getall()) >= config["crawl"]["maxvalue"]:
                     pass
         time.sleep(int(cycle))
コード例 #2
0
ファイル: tests.py プロジェクト: weihaigang/Proxypool
 def completion(self, *args):
     info("[测试器] 启动自动补足程序")
     self.parse = True
     self.errors = 0
     Crawler.run()
     self.parse = False