Skip to content

Expect KeyError, but raised AttributeError in client.py def __contains__(self, item) #131

@ukison

Description

@ukison

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions