Expect KeyError, but raised AttributeError in client.py def __contains__(self, item)
this is my code
job = service.jobs.create(query_to_run, *_kwargs_search) while True: job.refresh() stats = { "isDone": job["isDone"], "doneProgress": float(job["doneProgress"])_100, "scanCount": int(job["scanCount"]) if "scanCount" in job else 0, "eventCount": int(job["eventCount"]) if "eventCount" in job else 0, "resultCount": int(job["resultCount"]) if "resultCount" in job else 0 }
and this is the stack
File "/Users/ukison/sqbu-github.cisco.com/ukison/debug-tools/splunk/GetSplunkResults.py", line 95, in getSplunkResults "scanCount": int(job["scanCount"]) if "scanCount" in job else 0, File "/Library/Python/2.7/site-packages/splunklib/client.py", line 885, in contains self[item] File "/Library/Python/2.7/site-packages/splunklib/client.py", line 928, in getitem return getattr(self, key) File "/Library/Python/2.7/site-packages/splunklib/client.py", line 923, in getattr raise AttributeError(key) AttributeError: scanCount
We've just merged a fix to the develop branch. It will be out in the next release.
hi @shakeelmohamed do you know since what version of splunk python sdk is this fix available?
@duxing hi, the fix has been available since v1.6.1. See this commit: https://github.com/splunk/splunk-sdk-python/commit/70981e8f294ba78cd2537920813c8ccb0be4ab00
@shakeelmohamed thank you very much!