MCPcopy Index your code
hub / github.com/Python3WebSpider/ProxyPool / crawl

Method crawl

proxypool/crawlers/base.py:34–49  ·  view source on GitHub ↗

crawl main method

(self)

Source from the content-addressed store, hash-verified

32 yield proxy
33
34 def crawl(self):
35 """
36 crawl main method
37 """
38 try:
39 for url in self.urls:
40 logger.info(f'fetching {url}')
41 html = self.fetch(url)
42 if not html:
43 continue
44 time.sleep(.5)
45 yield from self.process(html, url)
46 except RetryError:
47 logger.error(
48 f'crawler {self} crawled proxy unsuccessfully, '
49 'please check if target url is valid or network issue')

Callers 1

runMethod · 0.45

Calls 2

fetchMethod · 0.95
processMethod · 0.95

Tested by

no test coverage detected