ProxyValidSchedule.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # -*- coding: utf-8 -*-
  2. """
  3. -------------------------------------------------
  4. File Name: ProxyValidSchedule.py
  5. Description : 验证useful_proxy_queue中的代理,将不可用的移出
  6. Author : JHao
  7. date: 2017/3/31
  8. -------------------------------------------------
  9. Change Activity:
  10. 2017/3/31: 验证useful_proxy_queue中的代理
  11. -------------------------------------------------
  12. """
  13. __author__ = 'JHao'
  14. import sys
  15. sys.path.append('../')
  16. from Schedule.ProxyCheck import ProxyCheck
  17. class ProxyValidSchedule(object):
  18. def __init__(self):
  19. pass
  20. def __validProxy(self, threads=5):
  21. """
  22. 验证useful_proxy代理
  23. :param threads: 线程数
  24. :return:
  25. """
  26. thread_list = list()
  27. for index in range(threads):
  28. thread_list.append(ProxyCheck())
  29. for thread in thread_list:
  30. thread.start()
  31. for thread in thread_list:
  32. thread.join()
  33. def main(self):
  34. self.__validProxy()
  35. def run():
  36. p = ProxyValidSchedule()
  37. p.main()
  38. if __name__ == '__main__':
  39. p = ProxyValidSchedule()
  40. p.main()