Unable to connect to a non-localhost when using splunk python SDK -


i'm trying use splunk's python sdk (http://docs.splunk.com/documentation/pythonsdk) connect splunk server, getting parseerror.

>>> pip install splunk-sdk >>> import splunklib.binding binding >>> cargs = {} >>> cargs['host'] = 'splunk.mydomain.com' >>> cargs['scheme'] = 'https' >>> cargs['port'] = 443 >>> cargs['username'] = 'my_username' >>> cargs['password'] = 'my_password' >>> c = binding.connect(**cargs)  traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "/myframework/lib/python2.7/site-packages/splunklib/binding.py", line 867, in connect     c.login()   file "/myframework/lib/python2.7/site-packages/splunklib/binding.py", line 753, in login     session = xml(body).findtext("./sessionkey")   file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/xml/etree/elementtree.py", line 1302, in xml     return parser.close()   file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/xml/etree/elementtree.py", line 1655, in close     self._raiseerror(v)   file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/xml/etree/elementtree.py", line 1507, in _raiseerror     raise err xml.etree.elementtree.parseerror: no element found: line 1, column 0 

so whatever page getting returned connect() doesn't have expected "./sessionkey"text. of examples i've seen use "localhost" host, i'm not sure if there's problem fact of external host. wish hands on returned page.

this host on corporate net, there should not access problem.

something getting returned; tested leaving out port, got me:

error: [errno 60] operation timed out

so, doing wrong here?

it looks using wrong port. default, splunk's management port 8089. unless have changed that, should using 8089 , not 443.

another way confirm url , credentials test via curl command line on same machine trying sdk:

curl -k https://splunk.mydomain.com:8089/services/auth/login -d username=my_username -d password=my_password 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -