@@ -140,8 +140,8 @@ def put(self, endpoint, data=None):
140140 """
141141 if endpoint [0 ] == "/" :
142142 endpoint = endpoint [1 :]
143- request_url = self .server + endpoint
144- response = self .session .put (request_url , headers = self .headers , data = data )
143+ request_url = self .server + endpoint + "?_method=PUT"
144+ response = self .session .post (request_url , headers = self .headers , data = data )
145145 if response .status_code != 200 :
146146 raise MFilesException (response .text )
147147 return response .json ()
@@ -381,7 +381,7 @@ def create_object(self, name, object_type=0, object_class=0,
381381 Returns:
382382 dict: Dictionary with object information.
383383 """
384- # pylint: disable=too-many-arguments
384+ # pylint: disable=too-many-arguments,too-many-positional-arguments
385385 extra_info = extra_info or {}
386386 file_info = file_info or []
387387 if isinstance (object_type , str ):
@@ -404,14 +404,14 @@ def create_object(self, name, object_type=0, object_class=0,
404404 endpoint = "objects/%s" % object_type
405405 return self .post (endpoint , data )
406406
407- def check_out (self , object_id , object_type = 0 ):
407+ def check_out (self , object_id , object_version = "latest" , object_type = 0 ):
408408 """Check out an object from M-Files."""
409409 data = json .dumps ({"Value" : "2" }) # Checked out by me
410- endpoint = "objects/%s/%s/latest /checkedout" % \
411- (object_type , object_id )
410+ endpoint = "objects/%s/%s/%s /checkedout" % \
411+ (object_type , object_id , object_version )
412412 return self .put (endpoint , data )
413413
414- def check_in (self , object_id , object_version , object_type = 0 ):
414+ def check_in (self , object_id , object_version = "latest" , object_type = 0 ):
415415 """Check in an object to M-Files."""
416416 data = json .dumps ({"Value" : "0" }) # Checked in
417417 endpoint = "objects/%s/%s/%s/checkedout" % \
@@ -476,7 +476,7 @@ def download_file(self, local_path, object_type, object_id, file_id,
476476 Returns:
477477 bool: True if file is found and downloaded successfully.
478478 """
479- # pylint: disable=too-many-arguments
479+ # pylint: disable=too-many-arguments,too-many-positional-arguments
480480 request_url = "%sobjects/%s/%s/%s/files/%s/content" % \
481481 (self .server , object_type , object_id , object_version , file_id )
482482 response = self .session .get (request_url , headers = self .headers )
0 commit comments