0

我正在尝试登录到 https 位置,但我遇到了这个错误。我不确定是什么导致了这个问题。谁能帮我解决这个问题?

2017-03-03T12:00:23: %T-ERROR: Caught exception during execution:
2017-03-03T12:00:23: %T-ERROR: Traceback (most recent call last):
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
2017-03-03T12:00:23: %T-ERROR:     chunked=chunked)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
2017-03-03T12:00:23: %T-ERROR:     self._validate_conn(conn)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
2017-03-03T12:00:23: %T-ERROR:     conn.connect()
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
2017-03-03T12:00:23: %T-ERROR:     ssl_context=context)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/util/ssl_.py", line 336, in ssl_wrap_socket
2017-03-03T12:00:23: %T-ERROR:     return context.wrap_socket(sock)
2017-03-03T12:00:23: %T-ERROR:   File "/auto/pysw/cel55/python/3.4.1/lib/python3.4/ssl.py", line 364, in wrap_socket
2017-03-03T12:00:23: %T-ERROR:     _context=self)
2017-03-03T12:00:23: %T-ERROR:   File "/auto/pysw/cel55/python/3.4.1/lib/python3.4/ssl.py", line 578, in __init__
2017-03-03T12:00:23: %T-ERROR:     self.do_handshake()
2017-03-03T12:00:23: %T-ERROR:   File "/auto/pysw/cel55/python/3.4.1/lib/python3.4/ssl.py", line 805, in do_handshake
2017-03-03T12:00:23: %T-ERROR:     self._sslobj.do_handshake()
2017-03-03T12:00:23: %T-ERROR: ConnectionResetError: [Errno 104] Connection reset by peer
2017-03-03T12:00:23: %T-ERROR: 
2017-03-03T12:00:23: %T-ERROR: During handling of the above exception, another exception occurred:
2017-03-03T12:00:23: %T-ERROR: 
2017-03-03T12:00:23: %T-ERROR: Traceback (most recent call last):
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
2017-03-03T12:00:23: %T-ERROR:     timeout=timeout
2017-03-03T12:00:23: %T-ERROR:File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
2017-03-03T12:00:23: %T-ERROR: stacktrace=sys.exc_info()[2])
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 347, in increment
2017-03-03T12:00:23: %T-ERROR:     raise six.reraise(type(error), error, _stacktrace)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/packages/six.py", line 685, in reraise
2017-03-03T12:00:23: %T-ERROR:     raise value.with_traceback(tb)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
2017-03-03T12:00:23: %T-ERROR:     chunked=chunked)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
2017-03-03T12:00:23: %T-ERROR:     self._validate_conn(conn)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
2017-03-03T12:00:23: %T-ERROR:     conn.connect()
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
2017-03-03T12:00:23: %T-ERROR:     ssl_context=context)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/packages/urllib3/util/ssl_.py", line 336, in ssl_wrap_socket
2017-03-03T12:00:23: %T-ERROR:     return context.wrap_socket(sock)
2017-03-03T12:00:23: %T-ERROR:   File "/auto/pysw/cel55/python/3.4.1/lib/python3.4/ssl.py", line 364, in wrap_socket
2017-03-03T12:00:23: %T-ERROR:     _context=self)
2017-03-03T12:00:23: %T-ERROR:   File "/auto/pysw/cel55/python/3.4.1/lib/python3.4/ssl.py", line 578, in __init__
2017-03-03T12:00:23: %T-ERROR:     self.do_handshake()
2017-03-03T12:00:23: %T-ERROR:   File "/auto/pysw/cel55/python/3.4.1/lib/python3.4/ssl.py", line 805, in do_handshake
2017-03-03T12:00:23: %T-ERROR:     self._sslobj.do_handshake()
2017-03-03T12:00:23: %T-ERROR: requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2017-03-03T12:00:23: %T-ERROR: 
2017-03-03T12:00:23: %T-ERROR: During handling of the above exception, another exception occurred:
2017-03-03T12:00:23: %T-ERROR: 
2017-03-03T12:00:23: %T-ERROR: Traceback (most recent call last):
2017-03-03T12:00:23: %T-ERROR:   File "usr/scripts/new_script.py", line 57, in setup
2017-03-03T12:00:23: %T-ERROR:     t.cfgmpbgp(rrnode = '201', local = '100')
2017-03-03T12:00:23: %T-ERROR:   File "usr/scripts/new.py", line 28, in wrapper
2017-03-03T12:00:23: %T-ERROR:     resp=requests.post(url,data=data,headers=headers,verify=False,cookies=cookies)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/api.py", line 110, in post
2017-03-03T12:00:23: %T-ERROR:     return request('post', url, data=data, json=json, **kwargs)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/api.py", line 56, in request
2017-03-03T12:00:23: %T-ERROR:     return session.request(method=method, url=url, **kwargs)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
2017-03-03T12:00:23: %T-ERROR:     resp = self.send(prep, **send_kwargs)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
2017-03-03T12:00:23: %T-ERROR:     r = adapter.send(request, **kwargs)
2017-03-03T12:00:23: %T-ERROR:   File "usr/lib/python3.4/site-packages/requests/adapters.py", line 473, in send
2017-03-03T12:00:23: %T-ERROR:     raise ConnectionError(err, request=request)

谁能帮我解决这个错误?

我也试过包括这个

import urllib.request
from urllib.request import Request, urlopen
4

1 回答 1

1

简而言之,你得到:

ConnectionResetError(104, 'Connection reset by peer')

此错误似乎与 SSL 无关,而是与网络有关。启动一个简单的 TCP 连接(例如使用telnet <host> <port>)是否有效?你不需要通过代理吗?您可以将proxies参数用于 requests.post() ( proxies={'https': 'http://yourproxy:port/'})

于 2017-03-03T08:10:42.273 回答