Splunk Enterprise

Python Connection SDK [Errno 11001] getaddrinfo failed

joeljoeljoel
Loves-to-Learn

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

Labels (1)
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Splunk App Dev Quarterly Roundup: AI, Agents, and Innovation!

Another quarter, another wave of innovation. From complex integrations to pushing the limits ...

Federated Search for Dynamic Data Self Storage Is Now Generally Available on Splunk ...

 Splunk is excited to announce the General Availability of Federated Search for Dynamic Data Self Storage ...

Index This | What has many keys but can’t unlock a door?

July 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...