Skip to content

Commit f4cff53

Browse files
authored
Merge pull request #83 from dataiku/enhancement/dss80-write-file-mf-subfolder-2
provide path to put_file to write in subfolder
2 parents 00612fc + f4c08ff commit f4cff53

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

dataikuapi/dss/managedfolder.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from ..utils import DataikuUTF8CSVReader
33
from ..utils import DataikuStreamedHttpUTF8CSVReader
44
import json
5+
from requests import utils
56
from .metrics import ComputedMetrics
67
from .future import DSSFuture
78
from .discussion import DSSObjectDiscussions
@@ -81,27 +82,26 @@ def get_file(self, path):
8182
the file's content, as a stream
8283
"""
8384
return self.client._perform_raw(
84-
"GET", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, path))
85+
"GET", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)))
8586

8687
def delete_file(self, path):
8788
"""
8889
Delete a file from the managed folder
8990
"""
9091
return self.client._perform_empty(
91-
"DELETE", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, path))
92+
"DELETE", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)))
9293

93-
def put_file(self, name, f):
94+
def put_file(self, path, f):
9495
"""
9596
Upload the file to the managed folder
9697
9798
Args:
9899
f: the file contents, as a stream
99-
name: the name of the file
100+
path: the path of the file
100101
"""
101-
102102
return self.client._perform_json_upload(
103-
"POST", "/projects/%s/managedfolders/%s/contents/" % (self.project_key, self.odb_id),
104-
name, f)
103+
"POST", "/projects/%s/managedfolders/%s/contents/%s" % (self.project_key, self.odb_id, utils.quote(path)),
104+
"", f)
105105

106106
########################################################
107107
# Managed folder actions

0 commit comments

Comments
 (0)