简体   繁体   中英

Python script is failing with ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

I've similar issue as many of you but cannot get this resolve. I'm producing a self-executable file that is running fine on my VirtualBox Linux 7.3 and 7.9 but when I'm trying to run it somewhere else (on other Linux servers) I'm getting the below output:

  Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 706, in urlopen
  File "urllib3/connectionpool.py", line 382, in _make_request
  File "urllib3/connectionpool.py", line 1010, in _validate_conn
  File "urllib3/connection.py", line 421, in connect
  File "urllib3/util/ssl_.py", line 429, in ssl_wrap_socket
  File "urllib3/util/ssl_.py", line 472, in _ssl_wrap_socket_impl
  File "ssl.py", line 365, in wrap_socket
  File "ssl.py", line 776, in __init__
  File "ssl.py", line 1036, in do_handshake
  File "ssl.py", line 648, in do_handshake
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 449, in send
  File "urllib3/connectionpool.py", line 756, in urlopen
  File "urllib3/util/retry.py", line 532, in increment
  File "urllib3/packages/six.py", line 734, in reraise
  File "urllib3/connectionpool.py", line 706, in urlopen
  File "urllib3/connectionpool.py", line 382, in _make_request
  File "urllib3/connectionpool.py", line 1010, in _validate_conn
  File "urllib3/connection.py", line 421, in connect
  File "urllib3/util/ssl_.py", line 429, in ssl_wrap_socket
  File "urllib3/util/ssl_.py", line 472, in _ssl_wrap_socket_impl
  File "ssl.py", line 365, in wrap_socket
  File "ssl.py", line 776, in __init__
  File "ssl.py", line 1036, in do_handshake
  File "ssl.py", line 648, in do_handshake
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "create_incident.py", line 415, in <module>
    open_incident_ticket()
  File "create_incident.py", line 368, in open_incident_ticket
    resp = requests.post(endpoint_uri, headers=headers, data = json.dumps(data))
  File "requests/api.py", line 119, in post
  File "requests/api.py", line 61, in request
  File "requests/sessions.py", line 542, in request
  File "requests/sessions.py", line 655, in send
  File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

My post constructor looks like:

resp = requests.post(endpoint_uri, headers=headers, data = json.dumps(data))

Could you pls advise me where exactly I need to look for it? Is there multiple issues that I'm struggling with? Many thanks, Mario

In the end, the issue was caused by firewall settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM