IPProxy.py 657 B

12345678910111213141516171819202122232425262728293031
  1. #coding:utf-8
  2. from multiprocessing import Value, Queue, Process
  3. from api.apiServer import start_api_server
  4. import sys
  5. from db.DataStore import store_data
  6. from spider.ProxyCrawl import startProxyCrawl
  7. from validator.Validator import validator
  8. reload(sys)
  9. sys.setdefaultencoding('utf8')
  10. if __name__=="__main__":
  11. DB_PROXY_NUM=Value('i',0)
  12. q1 = Queue()
  13. q2 = Queue()
  14. p0 = Process(target=start_api_server)
  15. p1 = Process(target=startProxyCrawl,args=(q1,DB_PROXY_NUM))
  16. p2 = Process(target=validator,args=(q1,q2))
  17. p3 = Process(target=store_data,args=(q2,DB_PROXY_NUM))
  18. p0.start()
  19. p1.start()
  20. p2.start()
  21. p3.start()