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

Method fetch

proxypool/crawlers/base.py:13–24  ·  view source on GitHub ↗
(self, url, **kwargs)

Source from the content-addressed store, hash-verified

11
12 @retry(stop_max_attempt_number=3, retry_on_result=lambda x: x is None, wait_fixed=2000)
13 def fetch(self, url, **kwargs):
14 try:
15 headers = Headers(headers=True).generate()
16 kwargs.setdefault('timeout', GET_TIMEOUT)
17 kwargs.setdefault('verify', False)
18 kwargs.setdefault('headers', headers)
19 response = requests.get(url, **kwargs)
20 if response.status_code == 200:
21 response.encoding = 'utf-8'
22 return response.text
23 except (requests.ConnectionError, requests.ReadTimeout):
24 return
25
26 def process(self, html, url):
27 """

Callers 4

crawlMethod · 0.95
__init__Method · 0.80
crawl_catalogMethod · 0.80
crawlMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected