When trying to connect to the Splunk SDK, Python throws me this error:
[Errno 11001] getaddrinfo failed
My code:
import splunklib.client as client
HOST = "localhost:"
PORT = 8000
USERNAME = "username"
PASSWORD = "password"
# Create a Service instance and log in
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
Throwback error is as following
File "Z:\BD_PROJ\Studenten_Trainees\BI Team\Eichberger_Sowa\00_NLP_Eichberger\99_Misc\.spyder-py3\NLP_GIT_online\untitled0.py", line 33, in <module>
service = client.connect(
File "C:\Users\eichberj\Test\lib\site-packages\splunklib\client.py", line 331, in connect
s.login()
File "C:\Users\eichberj\Test\lib\site-packages\splunklib\binding.py", line 883, in login
response = self.http.post(
File "C:\Users\eichberj\Test\lib\site-packages\splunklib\binding.py", line 1242, in post
return self.request(url, message)
File "C:\Users\eichberj\Test\lib\site-packages\splunklib\binding.py", line 1259, in request
response = self.handler(url, message, **kwargs)
File "C:\Users\eichberj\Test\lib\site-packages\splunklib\binding.py", line 1399, in request
connection.request(method, path, body, head)
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1010, in _send_output
self.send(msg)
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 950, in send
self.connect()
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1417, in connect
super().connect()
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 921, in connect
self.sock = self._create_connection(
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\socket.py", line 822, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Users\eichberj\AppData\Local\Programs\Python\Python39\lib\socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):