From 3d013c4c17209020bc582b7739b13c582b8f3eb9 Mon Sep 17 00:00:00 2001 From: rmaheshwari-splunk <84171674+rmaheshwari-splunk@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:05:20 +0530 Subject: [PATCH] Update client.py --- splunklib/client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/splunklib/client.py b/splunklib/client.py index b44d90bc..6115388e 100644 --- a/splunklib/client.py +++ b/splunklib/client.py @@ -3619,7 +3619,7 @@ def __init__(self, collection): self.service = collection.service self.collection = collection self.owner, self.app, self.sharing = collection._proper_namespace() - self.path = 'storage/collections/data/' + UrlEncoded(self.collection.name) + '/' + self.path = 'storage/collections/data/' + UrlEncoded(self.collection.name, encode_slash=True) + '/' def _get(self, url, **kwargs): return self.service.get(self.path + url, owner=self.owner, app=self.app, sharing=self.sharing, **kwargs) @@ -3652,7 +3652,7 @@ def query_by_id(self, id): :return: Document with id :rtype: ``dict`` """ - return json.loads(self._get(UrlEncoded(str(id))).body.read().decode('utf-8')) + return json.loads(self._get(UrlEncoded(str(id), encode_slash=True)).body.read().decode('utf-8')) def insert(self, data): """ @@ -3686,7 +3686,7 @@ def delete_by_id(self, id): :return: Result of DELETE request """ - return self._delete(UrlEncoded(str(id))) + return self._delete(UrlEncoded(str(id), encode_slash=True)) def update(self, id, data): """ @@ -3700,7 +3700,7 @@ def update(self, id, data): :return: id of replaced document :rtype: ``dict`` """ - return json.loads(self._post(UrlEncoded(str(id)), headers=KVStoreCollectionData.JSON_HEADER, body=data).body.read().decode('utf-8')) + return json.loads(self._post(UrlEncoded(str(id), encode_slash=True), headers=KVStoreCollectionData.JSON_HEADER, body=data).body.read().decode('utf-8')) def batch_find(self, *dbqueries): """