Splunk Dev

Does Python 3.9.2 not work for Splunk SDK 1.7.2 or is it that my search head uses https - authentication errors?

microserfs
Explorer

Does Python 3.9.2 not work for Splunk SDK 1.7.2?

Creating connection with this:

service = client.connect(
host=host,
port=port,
token=token
)

Using all the values (host, port, token) that work with a curl (-H) command.

This is the error that I'm getting:

Traceback (most recent call last):
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/binding.py", line 292, in wrapper
return request_fun(self, *args, **kwargs)
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/binding.py", line 73, in new_f
val = f(*args, **kwargs)
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/binding.py", line 699, in get
response = self.http.get(path, all_headers, **query)
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/binding.py", line 1232, in get
return self.request(url, { 'method': "GET", 'headers': headers })
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/binding.py", line 1304, in request
raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 401 Unauthorized -- call not properly authenticated

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/anonymous/xxxx.py", line 48, in <module>
for app in service.apps:
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/client.py", line 1411, in __iter__
for item in self.iter(**kwargs):
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/client.py", line 1574, in iter
response = self.get(count=pagesize or count, offset=offset, **kwargs)
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/client.py", line 1804, in get
return super(Collection, self).get(name, owner, app, sharing, **query)
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/client.py", line 862, in get
return self.service.get(path,
File "/home/anonymous/.local/lib/python3.9/site-packages/splunklib/binding.py", line 304, in wrapper
raise AuthenticationError(
splunklib.binding.AuthenticationError: Request failed: Session is not logged in.


Is it the python version or something to do with my search head host using `https`? 

Labels (3)
0 Karma

microserfs
Explorer

Please let me know if I need to post more information.

0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...