| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- # -*- coding: utf-8 -*-
- """
- -------------------------------------------------
- File Name: ProxyValidSchedule.py
- Description : 验证useful_proxy_queue中的代理,将不可用的移出
- Author : JHao
- date: 2017/3/31
- -------------------------------------------------
- Change Activity:
- 2017/3/31: 验证useful_proxy_queue中的代理
- -------------------------------------------------
- """
- __author__ = 'JHao'
- import sys
- sys.path.append('../')
- from Schedule.ProxyCheck import ProxyCheck
- class ProxyValidSchedule(object):
- def __init__(self):
- pass
- def __validProxy(self, threads=5):
- """
- 验证useful_proxy代理
- :param threads: 线程数
- :return:
- """
- thread_list = list()
- for index in range(threads):
- thread_list.append(ProxyCheck())
- for thread in thread_list:
- thread.daemon = True
- thread.start()
- for thread in thread_list:
- thread.join()
- def main(self):
- self.__validProxy()
- def run():
- p = ProxyValidSchedule()
- p.main()
- if __name__ == '__main__':
- p = ProxyValidSchedule()
- p.main()
|