-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
elastic/elastic-transport-python
#81Description
I am using:
- Python 3.8.13
- elasticsearch-py 8.1.2
- elastic transport: 8.1.1
- urllib3: 1.26.9
- certifi: 2020.06.20
- requests: 2.27.1
- Elasticsearch server 8.1.2
- default security setup of ES
- the host for ES to bind to is configured to be "192.168.0.5"
Running the following code:
es = Elasticsearch("https://192.168.0.5:9201", ca_certs=CACERTS, basic_auth=(USER, PASSWORD))
print("Client info:", es.info())
I get the exception:
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/elasticsearch/_sync/client/utils.py", line 404, in wrapped
return api(*args, **kwargs)
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/elasticsearch/_sync/client/__init__.py", line 2248, in info
return self.perform_request( # type: ignore[return-value]
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/elasticsearch/_sync/client/_base.py", line 286, in perform_request
meta, resp_body = self.transport.perform_request(
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/elastic_transport/_transport.py", line 329, in perform_request
meta, raw_data = node.perform_request(
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/elastic_transport/_node/_http_urllib3.py", line 164, in perform_request
response = self.pool.urlopen( # type: ignore[no-untyped-call]
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/urllib3/connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/home/johann/software/anaconda/envs/elastic/lib/python3.8/ssl.py", line 997, in _create
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
Running this curl command works fine though:
curl -X GET --cacert $CACERTS --user $USER:$PASSWORD "https://192.168.0.5:9201/"
When I search for the error message, most of them seem to be about proxies, but I do not have any proxies configured anywhere.
I have to admit, that error message is utterly cryptic to me and I have no idea what it could be about at all.
UPDATE: if I run this script on the host 192.168.0.5:
- if I use the URL https://192.168.0.5:9201 I get the same exception
- if I use the URL https://localhost:9201 it works just fine
Why would I need to provide a hostname instead of the IP to make this work? Why does curl not have the same limitation?
Metadata
Metadata
Assignees
Labels
No labels