Getting Data In

Why I am getting this error ? every credential is correctly provided?

ramesh12345
Explorer

import splunklib.client as client

HOST = "Host IP"
PORT = 8089
USERNAME = "my username"
PASSWORD = "password"

# Create a Service instance and log in
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)

# Print installed apps to the console to verify login
for app in service.apps:
print app.name

Traceback (most recent call last):
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 861, in login
cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 1208, in post
return self.request(url, message)
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 1228, in request
raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 401 Unauthorized -- Login failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Users\name\pyton programs\test.py", line 20, in
password=PASSWORD)
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\client.py", line 325, in connect
s.login()
File "D:\Users\name\Downloads\splunk-sdk-python-1.6.5\splunklib\binding.py", line 869, in login
raise AuthenticationError("Login failed.", he)
splunklib.binding.AuthenticationError: Login failed.

Tags (2)

vasanthi77
Explorer

facing same issue, have you resolved this one?

0 Karma

_robind
Engager

I have the same issue. I found this "you must contact Splunk to ensure that the credentials being used have access to the API on port 8089"
here:
https://interset.zendesk.com/hc/en-us/articles/115004545887-com-splunk-HttpException-HTTP-401-Login-...
Please respond if you managed to get this working, I am struggling to get a response from Splunk (I cannot raise a request ticket).

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

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 ...