testProxyFetcher.py 1023 B

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. """
  3. -------------------------------------------------
  4. File Name: testProxyFetcher
  5. Description :
  6. Author : JHao
  7. date: 2020/6/23
  8. -------------------------------------------------
  9. Change Activity:
  10. 2020/6/23:
  11. -------------------------------------------------
  12. """
  13. __author__ = 'JHao'
  14. from fetcher.proxyFetcher import ProxyFetcher
  15. from handler.configHandler import ConfigHandler
  16. def testProxyFetcher():
  17. conf = ConfigHandler()
  18. proxy_getter_functions = conf.fetchers
  19. for proxyGetter in proxy_getter_functions:
  20. proxy_count = 0
  21. for proxy in getattr(ProxyFetcher, proxyGetter.strip())():
  22. if proxy:
  23. print('{func}: fetch proxy {proxy},proxy_count:{proxy_count}'.format(func=proxyGetter, proxy=proxy,
  24. proxy_count=proxy_count))
  25. proxy_count += 1
  26. if __name__ == '__main__':
  27. testProxyFetcher()