Python 这是在web抓取中旋转代理的正确方法吗
我正在尝试在web抓取中从一组代理池中旋转代理。设置Python 这是在web抓取中旋转代理的正确方法吗,python,python-3.x,web-scraping,Python,Python 3.x,Web Scraping,我正在尝试在web抓取中从一组代理池中旋转代理。设置page\u response=“”是否正确 page_reponse = '' while page_reponse == '': proxy = next(proxy_pool) dict_proxy = {"http": proxy, "https": proxy} try: page_response = requests.get(iurl, headers=headers,timeout=tou
page\u response=“
”是否正确
page_reponse = ''
while page_reponse == '':
proxy = next(proxy_pool)
dict_proxy = {"http": proxy, "https": proxy}
try:
page_response = requests.get(iurl, headers=headers,timeout=tout, proxies=dict_proxy)
break
except requests.exceptions.ConnectionError as rec:
pass
在不使用selenium的情况下,我应该如何在代码中实现以下语句:
try a proxy for 3 times and if still it gives error then only i should go to next proxy in the list