python爬虫timeout_Python爬虫爬资源时由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。怎么破?...

craw 59 : http://www.sz.gov.cn/cn/xxgk/zfxxgj/tzgg/201701/t20170106_5866245.htm

craw 60 : http://www.sz.gov.cn/cn/xxgk/zfxxgj/tzgg/201701/t20170106_5866315.htm

Traceback (most recent call last):

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connection.py", line 138, in _new_conn

(self.host, self.port), self.timeout, **extra_kw)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\util\connection.py", line 98, in create_connection

raise err

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\util\connection.py", line 88, in create_connection

sock.connect(sa)

TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 594, in urlopen

chunked=chunked)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 361, in _make_request

conn.request(method, url, **httplib_request_kw)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1106, in request

self._send_request(method, url, body, headers)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1151, in _send_request

self.endheaders(body)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1102, in endheaders

self._send_output(message_body)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 934, in _send_output

self.send(msg)

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 877, in send

self.connect()

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connection.py", line 163, in connect

conn = self._new_conn()

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connection.py", line 147, in _new_conn

self, "Failed to establish a new connection: %s" % e)

requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x000001E7FA96F550>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\adapters.py", line 423, in send

timeout=timeout

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 643, in urlopen

_stacktrace=sys.exc_info()[2])

File "C:\Users\向晓宇\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\packages\urllib3\util\retry.py", line 363, in increment

raise MaxRetryError(_pool, url, error or ResponseError(cause))

requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='www.sz.gov.cn', port=80): Max retries exceeded with url: /cn/xxgk/zfxxgj/tzgg/201701/t20170106_5869715.htm (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x000001E7FA96F550>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。',))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值