收藏
回答

企业微信机器人之前发送请求没有问题,现在报104错误Connection reset by peer

使用python的requests进行请求,之前一直没有问题,昨天开始就报错,如下:

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'))

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

1 个回答

  • 企业微信运营专员-千夜
    企业微信运营专员-千夜
    2021-08-13

    你好,没有错误码应该是企业微信接口的报错,看起来是内部连接问题,可以先排查下

    2021-08-13
    有用
    回复
登录 后发表内容