Hi to all, i get a strange errorr using python SDK when connecting to balanced url instead of single host.
HOST = "splunk.balanced.url"
PORT = 8089
USERNAME = "admin"
PASSWORD = "changeme"
SCHEME ...
See more...
Hi to all, i get a strange errorr using python SDK when connecting to balanced url instead of single host.
HOST = "splunk.balanced.url"
PORT = 8089
USERNAME = "admin"
PASSWORD = "changeme"
SCHEME = "https"
APP = "my_app"
# Create a Service instance and log in to Splunk
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD,
scheme=SCHEME,
app=APP
)
for app in service.apps:
print app.name
But i got this error:
Traceback (most recent call last):
File "test_connection.py", line 32, in <module>
verify=False
File "/opt/splunk/etc/apps/framework/contrib/splunk-sdk-python/splunklib/client.py", line 288, in connect
return Service(**kwargs).login()
File "/opt/splunk/etc/apps/framework/contrib/splunk-sdk-python/splunklib/binding.py", line 753, in login
session = XML(body).findtext("./sessionKey")
File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 964, in XML
return parser.close()
File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 1254, in close
self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0
If i connect directly to the splunk host search head i got correct result: all app name. Bhind the balanced url there is only one host at the moment (the same host from which i get correct result). Someone got a similar problem? Could be a certificate issue? It seems that the XML returned is not correct.
Thanks very much and regards