Error responses raise XML parse error
The SDK handles all error responses with HTTP code <= 400 by raising a splunklib.binding.HTTPError exception as seen here.
In its turn HTTPError attempts to perform XML parsing on the response body. This results in a xml.etree.ElementTree.ParseError exception being raised in cases where the error response is JSON serialized and not in XML format and thus the error response details cannot be viewed.
You can reproduce it by attempting to create a search job with:
exec_mode=normaloutput_mode=jsonquery=invalid_query
Based on the search example variables:
service.jobs.create("invalid_query", **{"exec_mode":"normal", "output_mode":"json")
Thanks for reporting this @georgepsarakis - we think we know what might be causing this, and we'll take a look. As always, Pull Requests are welcome :)
Hi @georgepsarakis we've made the fix on the develop branch with https://github.com/splunk/splunk-sdk-python/commit/e4aaca81bfe4420876a8305706298e75b9876973. This change will go out with the next release (once we add some tests), stay tuned
Hi @georgepsarakis we've just released v1.4.0 that addresses this.
@shakeelmohamed thanks for your response!