IPProxy.py 675 B

1234567891011121314151617181920212223242526272829303132
  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. #import imp
  9. #imp.reload(sys)
  10. #sys.setdefaultencoding('utf8')
  11. if __name__=="__main__":
  12. DB_PROXY_NUM=Value('i',0)
  13. q1 = Queue()
  14. q2 = Queue()
  15. p0 = Process(target=start_api_server)
  16. p1 = Process(target=startProxyCrawl,args=(q1,DB_PROXY_NUM))
  17. p2 = Process(target=validator,args=(q1,q2))
  18. p3 = Process(target=store_data,args=(q2,DB_PROXY_NUM))
  19. p0.start()
  20. p1.start()
  21. p2.start()
  22. p3.start()