splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

how to resolve connecting to splunk via phython?

Open fishert123 opened this issue 4 years ago • 4 comments

I got the same error Traceback (most recent call last): File "./HelloWorld.py", line 19, in service = client.connect(host='splunk.xxxx.edu', port=443, username='user1', password=pswd) File "/usr/lib/python2.7/site-packages/splunklib/client.py", line 331, in connect s.login() File "/usr/lib/python2.7/site-packages/splunklib/binding.py", line 886, in login session = XML(body).findtext("./sessionKey") File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1300, in XML parser.feed(text) File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1642, in feed self._raiseerror(v) File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror raise err xml.etree.ElementTree.ParseError: syntax error: line 1, column 0

I came across a reply here https://github.com/splunk/splunk-sdk-python/issues/311 The response body isn't xml, it's html: b'<!doctype html>303 See Other

See Other

The resource has moved temporarily here.

\r\n'

How to resolve this ? Can I force python script to accept html instead of xml ?

thanks !!

fishert123 avatar Oct 02 '22 18:10 fishert123

Was having the same issue - was using an incorrect URL (one that could handle REST calls), once I updated the host it started to work.

jose1711 avatar Oct 05 '22 13:10 jose1711

thanks so much !!

On Wed, 5 Oct 2022 at 06:00, Jose Riha @.***> wrote:

Was having the same issue - was using an incorrect URL (one that could handle REST calls), once I updated the host it started to work.

— Reply to this email directly, view it on GitHub https://github.com/splunk/splunk-sdk-python/issues/489#issuecomment-1268404201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTREPTSL3C6IQ56OZMK753WBV3WRANCNFSM6AAAAAAQ3ABJKQ . You are receiving this because you authored the thread.Message ID: @.***>

fishert123 avatar Oct 05 '22 17:10 fishert123

@fishert123 Can you confirm if this issue is resolved for you and it can be closed?

ncanumalla-splunk avatar Oct 05 '22 21:10 ncanumalla-splunk

Yes, it is working. You can close it. Thanks so much .

On Wed, 5 Oct 2022 at 14:00, ncanumalla-splunk @.***> wrote:

@fishert123 https://github.com/fishert123 Can you confirm if this issue is resolved for you and it can be closed?

— Reply to this email directly, view it on GitHub https://github.com/splunk/splunk-sdk-python/issues/489#issuecomment-1268970085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTREPRBBADBOSUABNG32PLWBXT65ANCNFSM6AAAAAAQ3ABJKQ . You are receiving this because you were mentioned.Message ID: @.***>

fishert123 avatar Oct 05 '22 23:10 fishert123