Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix for Issue#361 #397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions splunklib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -3657,7 +3657,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):
"""
Expand Down Expand Up @@ -3693,7 +3693,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):
"""
Expand All @@ -3709,7 +3709,7 @@ def update(self, id, data):
"""
if isinstance(data, dict):
data = json.dumps(data)
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):
"""
Expand Down