requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
Traceback (most recent call last):
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 761, in _update_chunk_length
self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 444, in _error_catcher
yield
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 828, in read_chunked
self._update_chunk_length()
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 765, in _update_chunk_length
raise InvalidChunkLength(self, line)
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\models.py", line 816, in generate
yield from self.raw.stream(chunk_size, decode_content=True)
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 624, in stream
for line in self.read_chunked(amt, decode_content=decode_content):
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 816, in read_chunked
with self._error_catcher():
File "D:\code_tool\python\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\urllib3\response.py", line 461, in _error_catcher
raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\code_tool\spiderYesmro3\main.py", line 253, in <module>
main()
File "D:\code_tool\spiderYesmro3\main.py", line 30, in main
for cate, lists in get_data():
File "D:\code_tool\spiderYesmro3\main.py", line 99, in get_data
resp = requests.get(detail_cate_url, headers=headers)
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\sessions.py", line 745, in send
r.content
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\models.py", line 899, in content
self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
File "D:\code_tool\spiderYesmro3\venv\lib\site-packages\requests\models.py", line 818, in generate
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
Process finished with exit code 1
本文来自博客园,作者:chuangzhou,转载请注明原文链接:https://www.cnblogs.com/czzz/p/17081646.html