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`?
Please let me know if I need to post more information.