Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to resolve connecting to splunk via phython? #489

Closed
fishert123 opened this issue Oct 2, 2022 · 4 comments
Closed

how to resolve connecting to splunk via phython? #489

fishert123 opened this issue Oct 2, 2022 · 4 comments

Comments

@fishert123
Copy link

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 #311
The response body isn't xml, it's html:
b'<!doctype html><title>303 See Other</title>

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
Copy link

jose1711 commented Oct 5, 2022

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
Copy link
Author

fishert123 commented Oct 5, 2022 via email

@ncanumalla-splunk
Copy link
Contributor

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

@fishert123
Copy link
Author

fishert123 commented Oct 5, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants