diff --git a/splunklib/client.py b/splunklib/client.py index ee390c9e..e102315a 100644 --- a/splunklib/client.py +++ b/splunklib/client.py @@ -779,7 +779,7 @@ def get_api_version(self, path): # For example, "/services/search/jobs" is using API v1 api_version = 1 - versionSearch = re.search('(?:servicesNS\/[^/]+\/[^/]+|services)\/[^/]+\/v(\d+)\/', path) + versionSearch = re.search('(?:services(?:NS)?)\/{1,2}\w+\/{1,2}v(\d)\/{1,2}', path) if versionSearch: api_version = int(versionSearch.group(1)) @@ -3999,4 +3999,4 @@ def batch_save(self, *documents): data = json.dumps(documents) return json.loads( - self._post('batch_save', headers=KVStoreCollectionData.JSON_HEADER, body=data).body.read().decode('utf-8')) \ No newline at end of file + self._post('batch_save', headers=KVStoreCollectionData.JSON_HEADER, body=data).body.read().decode('utf-8'))