Skip to content

Commit cd54110

Browse files
committed
code refactoring
1 parent 964fd30 commit cd54110

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

splunklib/client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,10 @@ def get(self, path_segment="", owner=None, app=None, sharing=None, **query):
837837
# path = path.replace(PATH_JOBS_V2, PATH_JOBS)
838838

839839
if api_version == 1:
840-
path = path.replace(PATH_JOBS_V2, PATH_JOBS)
840+
if isinstance(path, UrlEncoded):
841+
path = UrlEncoded(path.replace(PATH_JOBS_V2, PATH_JOBS), skip_encode=True)
842+
else:
843+
path = path.replace(PATH_JOBS_V2, PATH_JOBS)
841844

842845
return self.service.get(path,
843846
owner=owner, app=app, sharing=sharing,
@@ -909,7 +912,10 @@ def post(self, path_segment="", owner=None, app=None, sharing=None, **query):
909912
# path = path.replace(PATH_JOBS_V2, PATH_JOBS)
910913

911914
if api_version == 1:
912-
path = path.replace(PATH_JOBS_V2, PATH_JOBS)
915+
if isinstance(path, UrlEncoded):
916+
path = UrlEncoded(path.replace(PATH_JOBS_V2, PATH_JOBS), skip_encode=True)
917+
else:
918+
path = path.replace(PATH_JOBS_V2, PATH_JOBS)
913919

914920
return self.service.post(path, owner=owner, app=app, sharing=sharing, **query)
915921

0 commit comments

Comments
 (0)