使用requests时,报错ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1122)
完整报错信息如下:文章来源:https://www.toymoban.com/news/detail-508246.html
Traceback (most recent call last):
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen
self._prepare_proxy(conn)
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 996, in _prepare_proxy
conn.connect()
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\connection.py", line 364, in connect
self.sock = conn = self._connect_tls_proxy(hostname, conn)
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\connection.py", line 499, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "D:\Academic\Python\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "D:\Academic\Python\Python39\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "D:\Academic\Python\Python39\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1122)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Academic\Python\Python39\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "D:\Academic\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='tsms-drcn.security.dbankcloud.cn', port=443): Max retries exceeded with url: /tsms/v2/attest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\AcademicWorkplace\DeviceIntegrity\SafetyDetect\HMSAna\web-curl-py.py", line 17, in <module>
response = requests.post('https://tsms-drcn.security.dbankcloud.cn/tsms/v2/attest', headers=headers, json=json_data)
File "D:\Academic\Python\Python39\lib\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "D:\Academic\Python\Python39\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "D:\Academic\Python\Python39\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "D:\Academic\Python\Python39\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "D:\Academic\Python\Python39\lib\site-packages\requests\adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='tsms-drcn.security.dbankcloud.cn', port=443): Max retries exceeded with url: /tsms/v2/attest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)')))
解决方法:关闭系统网络代理软件(关闭System Proxy)文章来源地址https://www.toymoban.com/news/detail-508246.html
到了这里,关于【python】报错ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1122)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!