描述:
爬取网页列表,每次大概请求20次的时候就会出错。 程序报错退出,实际页面上将跳转到图片验证机器人的地方,这个怎么办? 至少希望在完成认证后,能接着上一次的请求继续执行。
代码:
def handle(self): request = urllib.request.Request(self.url,headers=self.headers) response = urllib.request.urlopen(request) print(response) html=response.read()
报错:
urllib.error.HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
苦恼
目前是每次请求15条,循环执行。失败后,手动验证并对循环+1,再执行。
相关分类