我正在使用请求和BeautifulSoup通过在网页上使用BeautifulSoup迭代从缩略图解析的链接来下载更高分辨率的图像。
在我的系统上与python [2.7]中的请求模块建立多个连接有时可以顺利运行,也可能在下一次运行中途中止,并出现以下错误:
File "G:\imgDownloader.py", line 69, in imageSearch
dwdPage = requests.get(dwdLink)
File "C:\Python27\lib\site-packages\requests\api.py", line 69, in get
return request('get', url, params=params, **kwargs)
File "C:\Python27\lib\site-packages\requests\api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it'))
我的系统通过大学局域网(通过Proxifier)连接到互联网(我不知道这是否重要,所以原谅我)。
如果需要使用会话,那么为什么执行/堕胎行为不确定?