【发布时间】:2017-07-10 01:11:01
【问题描述】:
我正在大型网站上制作网络爬虫。但是,由于连接不稳定,它总是会遇到关闭连接、SSL 错误或其他间歇性故障。因此,我正在寻找一种方法来处理这个问题。这是我下面的代码,谁能告诉我如何实现等待或在有网络连接时再次尝试重新启动项目
try:
requests.get("http://example.com")
except requests.exceptions.RequestException:
pass # handle the exception. maybe wait and try again later
【问题讨论】:
标签: python web-scraping beautifulsoup web-crawler network-connection