简体   繁体   English

连接错误(&#39;<urllib3.connection.HTTPSConnection object at 0x7f3a5d760390> : 建立新连接失败: [Errno 111] 连接被拒绝&#39;)

[英]ConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3a5d760390>: Failed to establish a new connection: [Errno 111] Connection refused')

I am facing Connection Error with urllib which is used by FHIR_parser.我正面临 FHIR_parser 使用的 urllib 的连接错误。 This error happens in a GET request to the endpoint which accepts the patient id.此错误发生在对接受患者 ID 的端点的 GET 请求中。 Link to repository : https://github.com/greenfrogs/FHIR-Parser链接到存储库: https : //github.com/greenfrogs/FHIR-Parser

requests - 2.24.0, urllib3 version : 1.25.10, python : 3.7请求 - 2.24.0,urllib3 版本:1.25.10,python:3.7

>> from fhir_parser import FHIR
>> fhir = FHIR()
>> patient = fhir.get_patient('8f789d0b-3145-4cf2-8504-13159edaa747')

Connection Error连接错误

Error
Traceback (most recent call last):
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, 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 "/home/joel/.local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
conn.connect()
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/connection.py", line 309, in connect
conn = self._new_conn()
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f3a5d760390>: 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 "/home/joel/.local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/joel/.local/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/Patient/8f789d0b-3145-4cf2-8504-13159edaa747 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3a5d760390>: 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 "", line 1, in
File "/home/joel/.local/lib/python3.7/site-packages/fhir_parser/fhir.py", line 73, in get_patient
response = requests.get(urllib.parse.urljoin(self.endpoint, 'Patient/' + str(id)), verify=self.verify_ssl)
File "/home/joel/.local/lib/python3.7/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/home/joel/.local/lib/python3.7/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/joel/.local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/home/joel/.local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/home/joel/.local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/Patient/8f789d0b-3145-4cf2-8504-13159edaa747 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3a5d760390>: Failed to establish a new connection: [Errno 111] Connection refused'))

This library is just a FHIR client, there's no server.这个库只是一个 FHIR 客户端,没有服务器。 So you must provide FHIR server's address/URL, by default it expects server to be run on local host and port 5001, and uses URL like https://localhost:5001/api/ .所以你必须提供 FHIR 服务器的地址/URL,默认情况下它期望服务器在本地主机和端口 5001 上运行,并使用像https://localhost:5001/api/这样的 URL。 Or you need to run FHIR server yourself on local host.或者您需要在本地主机上自己运行 FHIR 服务器。

from fhir_parser import FHIR
fhir = FHIR(endpoint = 'https://SomeServer.com:SomePort/api/')
print(fhir.get_patient('8f789d0b-3145-4cf2-8504-13159edaa747'))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ping NewConnectionError(&#39;<urllib3.connection.HTTPSConnection object at ...> : 建立新连接失败: [Errno 110] 连接超时&#39;)) - ping NewConnectionError('<urllib3.connection.HTTPSConnection object at ...>: Failed to establish a new connection: [Errno 110] Connection timed out')) 新连接错误(<urllib3.connection.HTTPConnection object at 0x7f09b9f0a7c0> : 建立新连接失败: [Errno 111] 连接被拒绝) - NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f09b9f0a7c0>: Failed to establish a new connection: [Errno 111] Connection refused) Docker - Elasticsearch - 无法建立新连接:[Errno 111] Connection refused',)) - Docker - Elasticsearch - Failed to establish a new connection: [Errno 111] Connection refused',)) 连接错误(<urllib3.connection.HTTPConnection object at 0x7f70f408b3c8> : 建立新连接失败 - ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f70f408b3c8>: Failed to establish a new connection 请求 - Python - 无法建立新连接:[Errno 111] 连接被拒绝 - Requests - Python - Failed to establish a new connection: [Errno 111] Connection refused urllib3 - 无法建立新连接:[Errno 111] - urllib3 - Failed to establish a new connection: [Errno 111] Docker build pytest:无法建立新连接:[Errno 111]连接被拒绝 - Docker build pytest :Failed to establish a new connection: [Errno 111] Connection refused requests.exceptions.ConnectionError:无法建立新连接:0x05:连接被拒绝 - requests.exceptions.ConnectionError: Failed to establish a new connection: 0x05: Connection refused urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fedc69d9c50> :无法建立新的连接 - urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fedc69d9c50>: Failed to establish a new connection NOVA [Errno 111]拒绝连接 - NOVA [Errno 111] Connection refused
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM