Hi,
you should first check kv store exist or not. if exist then you can access the kv store otherwise you can create. but in your code you try to accessing kvstore before checking kv store exist or not. so the problem here is test kvstore does not exist in splunk collection thats why getting key error.
i have modified the code below. hope this should work!!!.
collection_name="test"
if collection_name in splunk_service.kvstore:
print("{} Already exist !!!".format(collection_name))
else:
splunk_service.kvstore.create(collection_name)
#Adding data to KV store
collection.data.insert(json.dumps({"ID":"123","sId":1234,"Tech":"text"}))
collection=splunk_service.kvstore[collection_name]
... View more