当前位置:   article > 正文

python request 报错ConnectionRefusedError: [Errno 111] Connection refused_conda env list connectionrefusederror: [errno 111]

conda env list connectionrefusederror: [errno 111] connection refused

调试接口请求的时候,报连接错误,

后来发现,是端口错了。试了下,ip搞错也会这样报错的

『『需自动化项目源码\交流学习添加v:ct-xiaozhou

免费提供的。行业变迁,多个好友多点可能性。非机构』』


详细报错如下:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 170, in _new_conn

    (self._dns_host, self.port), self.timeout, **extra_kw

  File "/usr/local/lib/python3.7/dist-packages/urllib3/util/connection.py", line 96, in create_connection

    raise err

  File "/usr/local/lib/python3.7/dist-packages/urllib3/util/connection.py", line 86, in create_connection

    sock.connect(sa)

ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 706, in urlopen

    chunked=chunked,

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 394, in _make_request

    conn.request(method, url, **httplib_request_kw)

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 234, in request

    super(HTTPConnection, self).request(method, url, body=body, headers=headers)

  File "/usr/lib/python3.7/http/client.py", line 1260, in request

    self._send_request(method, url, body, headers, encode_chunked)

  File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request

    self.endheaders(body, encode_chunked=encode_chunked)

  File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders

    self._send_output(message_body, encode_chunked=encode_chunked)

  File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output

    self.send(msg)

  File "/usr/lib/python3.7/http/client.py", line 970, in send

    self.connect()

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 200, in connect

    conn = self._new_conn()

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 182, in _new_conn

    self, "Failed to establish a new connection: %s" % e

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f007afbb5f8>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 449, in send

    timeout=timeout

  File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 756, in urlopen

    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]

  File "/usr/local/lib/python3.7/dist-packages/urllib3/util/retry.py", line 574, in increment

    raise MaxRetryError(_pool, url, error or ResponseError(cause))

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='10.00.00.41', port=8001): Max retries exceeded with url: /api//detail/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f007afbb5f8>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/media/wzg/文档/zhouzy/pythonworkspace/sx_apitest/realTimeApiTest/shuixin/mockTest.py", line 66, in <module>

    shuixinMock_order_detail()

  File "/media/wzg/文档/zhouzy/pythonworkspace/sx_apitest/realTimeApiTest/shuixin/mockTest.py", line 61, in shuixinMock_order_detail

    re = request(method=method, url=url, json=body)

  File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 61, in request

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

  File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 542, in request

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

  File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 655, in send

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

  File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 516, in send

    raise ConnectionError(e, request=request)

requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.00.00.41', port=8001): Max retries exceeded with url: /api/detail/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f007afbb5f8>: Failed to establish a new connection: [Errno 111] Connection refused'))

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/148308
推荐阅读
相关标签
  

闽ICP备14008679号