I am following the Splunk SDK example using version 1.6.3 with Python 3, on Splunk 6.6.4:
import splunklib.client as client
HOST = "localhost"
PORT = 8000
USERNAME = "admin"
PASSWORD = "changeme"
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD)
for app in service.apps:
print app.name
I have changed the hard-coded credentials to match valid login info, however I am receiving the following response:
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 6, in
password=PASSWORD
File "/opt/anaconda3/lib/python3.6/site-packages/splunk_sdk-1.6.3-py3.6.egg/splunklib/client.py", line 322, in connect
s.login()
File "/opt/anaconda3/lib/python3.6/site-packages/splunk_sdk-1.6.3-py3.6.egg/splunklib/binding.py", line 862, in login
session = XML(body).findtext("./sessionKey")
File "/opt/anaconda3/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML
parser.feed(text)
File "", line unknown
ParseError: syntax error: line 1, column 0
... View more