@@ -82,11 +82,10 @@ def initialise(token: str, config: str, script: str) -> dict:
8282 config_location_url = config_location_response ["url" ]
8383
8484 # Configure Yaml File Type
85- config_filetype_response = fdp_utils .post_entry (
85+ config_filetype_response = fdp_utils .post_file_type (
8686 token = token ,
8787 url = registry_url ,
88- endpoint = "file_type" ,
89- data = {"name" : "yaml" , "extension" : "yaml" },
88+ data = {"name" : "YAML Document" , "extension" : "yaml" },
9089 api_version = api_version ,
9190 )
9291 config_filetype_url = config_filetype_response ["url" ]
@@ -174,14 +173,14 @@ def initialise(token: str, config: str, script: str) -> dict:
174173 )
175174
176175 script_location_url = script_location_response ["url" ]
176+ script_file_type = os .path .basename (script ).split ("." )[- 1 ]
177177
178178 # TODO: Change to Batch?
179179 # Create Script File Type
180- script_filetype_response = fdp_utils .post_entry (
180+ script_filetype_response = fdp_utils .post_file_type (
181181 token = token ,
182182 url = registry_url ,
183- endpoint = "file_type" ,
184- data = {"name" : "py" , "extension" : "py" },
183+ data = {"name" : "python submission script" , "extension" : script_file_type },
185184 api_version = api_version ,
186185 )
187186
@@ -478,23 +477,11 @@ def finalise(token: str, handle: dict) -> None:
478477
479478 file_type = os .path .basename (new_path ).split ("." )[- 1 ]
480479
481- file_type_exists = fdp_utils .get_entry (
480+ file_type_url = fdp_utils .post_file_type (
481+ token = token ,
482482 url = registry_url ,
483- endpoint = "file_type" ,
484- query = {"extension" : file_type },
483+ data = {"name" : file_type , "extension" : file_type },
485484 api_version = api_version ,
486- )
487-
488- if file_type_exists :
489- entry = fdp_utils .get_first_entry (file_type_exists )
490- file_type_url = entry ["url" ]
491- else :
492- file_type_url = fdp_utils .post_entry (
493- token = token ,
494- url = registry_url ,
495- endpoint = "file_type" ,
496- data = {"name" : file_type , "extension" : file_type },
497- api_version = api_version ,
498485 )["url" ]
499486
500487 data_product_exists = fdp_utils .get_entry (
0 commit comments