Python 脚本失败,出现 ('Connection aborted.' , ConnectionResetError(104, 'Connection reset by peer' ))

标签 python python-3.x rest ssl python-jsons

我和你们中的许多人有类似的问题,但无法解决。我正在生成一个在我的 VirtualBox Linux 7.3 和 7.9 上运行良好的自执行文件,但是当我尝试在其他地方(在其他 Linux 服务器上)运行它时,我得到以下输出:

  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'))
我的帖子构造函数如下所示:
resp = requests.post(endpoint_uri, headers=headers, data = json.dumps(data))
你能告诉我我到底需要在哪里寻找它吗?我是否有多个问题正在努力解决?
非常感谢,
马里奥

最佳答案

最后,问题是由防火墙设置引起的。

关于Python 脚本失败,出现 ('Connection aborted.' , ConnectionResetError(104, 'Connection reset by peer' )),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70379603/

相关文章:

python - 如何针对 sci-kit 学习库中的某一类别对 SVM 进行惩罚?

python - 如果我在当前类中有一个同名函数,我该如何调用父方法(如果可能)

python - 如何将 UTF-8 转换为转义字符串

python - 使用 lambda 在回调中设置属性

python - 如何在 Python 的嵌套列表中获取具有最多共同元素的两个列表

python - 当下一个元素是文本时 xpath 中的异常

python-3.x - 读取多索引 Excel 文件并 reshape Pandas 中的标题

java - 返回空 JSON 的 Jersey Web 服务

java - Spring 支架 Controller

ruby-on-rails - 如何通过删除谷歌分析中的资源 ID 来合并 REST 样式的显示页面