print( len(response2.read()))一会好一会报错
正常结果
第一种方法
200
98028
报错
200
Traceback (most recent call last):
File "D:\Program Files\Python35\lib\http\client.py", line 546, in _readall_chunked
value.append(self._safe_read(chunk_left))
File "D:\Program Files\Python35\lib\http\client.py", line 594, in _safe_read
raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(9849 bytes read, 3009 more expected)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Code\eclipse\spider\test\test_urllib.py", line 9, in <module>
print( len(response1.read()) )
File "D:\Program Files\Python35\lib\http\client.py", line 440, in read
return self._readall_chunked()
File "D:\Program Files\Python35\lib\http\client.py", line 550, in _readall_chunked
raise IncompleteRead(b''.join(value))
http.client.IncompleteRead: IncompleteRead(85170 bytes read)