splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
687 stars 369 forks source link

how to resolve connecting to splunk via phython? #489

Closed fishert123 closed 1 year ago

fishert123 commented 1 year ago

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 !!

jose1711 commented 1 year ago

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.

fishert123 commented 1 year ago

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: @.***>

ncanumalla-splunk commented 1 year ago

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

fishert123 commented 1 year ago

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: @.***>