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
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...