Python - request 报错:raise RemoteDisconnected("Remote end closed connection without"
2022-11-15 21:46:20,261 INFO [get_data.py(get_product_mode:46)] - 当前page======>:255
Traceback (most recent call last):
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "D:\code_tool\python\lib\http\client.py", line 1374, in getresponse
response.begin()
File "D:\code_tool\python\lib\http\client.py", line 318, in begin
version, status, reason = self._read_status()
File "D:\code_tool\python\lib\http\client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\util\retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\packages\six.py", line 769, in reraise
raise value.with_traceback(tb)
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "D:\code_tool\python\lib\http\client.py", line 1374, in getresponse
response.begin()
File "D:\code_tool\python\lib\http\client.py", line 318, in begin
version, status, reason = self._read_status()
File "D:\code_tool\python\lib\http\client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\jlc_auto_test\fa_search_test\tools\get_data.py", line 108, in get_code_status
resp = requests.post(url, json=req_body, headers=header).json()
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "D:\jlc_auto_test\fa_search_test\venv\lib\site-packages\requests\adapters.py", line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\jlc_auto_test\fa_search_test\run.py", line 9, in <module>
get_data.get_product_mode()
File "D:\jlc_auto_test\fa_search_test\tools\get_data.py", line 52, in get_product_mode
page_models = get_page_modes(json_data)
File "D:\jlc_auto_test\fa_search_test\tools\get_data.py", line 78, in get_page_modes
code_status = get_code_status(code)
File "D:\jlc_auto_test\fa_search_test\tools\get_data.py", line 110, in get_code_status
logging.info(e,resp.text)
AttributeError: 'NoneType' object has no attribute 'text'
Process finished with exit code 1
解决方案:https://blog.csdn.net/the_beginner/article/details/118312032
本文来自博客园,作者:chuangzhou,转载请注明原文链接:https://www.cnblogs.com/czzz/p/16894722.html