MCPcopy Create free account
hub / github.com/Python3WebSpider/ProxyPool / run

Method run

examples/usage2.py:65–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63 self.fetchSecond = fetchSecond
64
65 def run(self):
66 global ips
67 while True:
68 # 获取IP列表
69 res = requests.get(apiUrl).content.decode()
70 # 按照\n分割获取到的IP
71 ips = res.split('\n')
72 # 利用每一个IP
73 for proxyip in ips:
74 if proxyip.strip():
75 # 开启一个线程
76 # CrawlThread(proxyip).start()
77 try:
78 CrawlThread(proxyip).run()
79 time.sleep(1.5)
80 except Exception as e:
81 print(e)
82 # 休眠
83 time.sleep(len(ips) /self.fetchSecond )
84
85
86if __name__ == '__main__':

Callers

nothing calls this directly

Calls 2

CrawlThreadClass · 0.85
runMethod · 0.45

Tested by

no test coverage detected