收藏
回答

企业微信机器人报104错误

使用python的requests进行post,之前一直没有问题,昨天刚出现,报错如下

Traceback (most recent call last):

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen

    httplib_response = self._make_request(

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 381, in _make_request

    self._validate_conn(conn)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn

    conn.connect()

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connection.py", line 361, in connect

    self.sock = ssl_wrap_socket(

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 377, in ssl_wrap_socket

    return context.wrap_socket(sock, server_hostname=server_hostname)

  File "/home/yong_sun/Python-3.8.3/lib/python3.8/ssl.py", line 500, in wrap_socket

    return self.sslsocket_class._create(

  File "/home/yong_sun/Python-3.8.3/lib/python3.8/ssl.py", line 1040, in _create

    self.do_handshake()

  File "/home/yong_sun/Python-3.8.3/lib/python3.8/ssl.py", line 1309, in do_handshake

    self._sslobj.do_handshake()

ConnectionResetError: [Errno 104] Connection reset by peer


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send

    resp = conn.urlopen(

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 724, in urlopen

    retries = retries.increment(

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 403, in increment

    raise six.reraise(type(error), error, _stacktrace)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise

    raise value.with_traceback(tb)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen

    httplib_response = self._make_request(

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 381, in _make_request

    self._validate_conn(conn)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn

    conn.connect()

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/connection.py", line 361, in connect

    self.sock = ssl_wrap_socket(

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 377, in ssl_wrap_socket

    return context.wrap_socket(sock, server_hostname=server_hostname)

  File "/home/yong_sun/Python-3.8.3/lib/python3.8/ssl.py", line 500, in wrap_socket

    return self.sslsocket_class._create(

  File "/home/yong_sun/Python-3.8.3/lib/python3.8/ssl.py", line 1040, in _create

    self.do_handshake()

  File "/home/yong_sun/Python-3.8.3/lib/python3.8/ssl.py", line 1309, in do_handshake

    self._sslobj.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 "<stdin>", line 1, in <module>

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/requests/api.py", line 119, in post

    return request('post', url, data=data, json=json, **kwargs)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request

    return session.request(method=method, url=url, **kwargs)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/requests/sessions.py", line 530, in request

    resp = self.send(prep, **send_kwargs)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/requests/sessions.py", line 643, in send

    r = adapter.send(request, **kwargs)

  File "/home/yong_sun/bin/workflow/venv/lib/python3.8/site-packages/requests/adapters.py", line 498, in send

    raise ConnectionError(err, request=request)

requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))


回答关注问题邀请回答
收藏

2 个回答

  • Jinn
    Jinn
    2023-07-12

    类似问题,有没解?

    相同代码,一台机器可以,另台不行

    2023-07-12
    有用
    回复
  • Tom
    Tom
    2022-07-21

    这个为啥没人回复?


    2022-07-21
    有用
    回复
登录 后发表内容