pyslk.json2hsm

Contents

pyslk.json2hsm#

pyslk.json2hsm(json_file: str | None = None, restart_file: str | None = None, schema: str | list | None = None, expect_json_lines: bool = False, verbose: bool = False, quiet: bool = False, ignore_non_existing_metadata_fields: bool = False, write_mode: str | None = None, instant_metadata_record_update: bool = False, use_res_id: bool = False, skip_bad_metadata_sets: bool = False, json_string: str | None = None) dict#

Read metadata from JSON file and write them to archived files into HSM. Use absolute paths from metadata records to identify target files.

Parameters:
  • json_file (str) – JSON input file containing metadata

  • restart_file (str = None,) – set a restart file in which the processed metadata entries are listed

  • schema (str or list) – import only metadata fields of listed schemata; if str: comma-separated list without spaces

  • expect_json_lines (bool) – read JSON-lines from file instead of JSON

  • verbose (bool) – verbose mode

  • quiet (bool) – quiet mode

  • ignore_non_existing_metadata_fields (bool) – do not throw an error if a metadata field is used, which does not exist in StrongLink

  • write_mode (str) – select write mode for metadata: OVERWRITE, KEEP, ERROR, CLEAN

  • use_res_id (bool) – use resource_id instead of path to identify file

  • skip_bad_metadata_sets (bool) – skip damaged / incomplete metadata sets [default: throw error]

  • instant_metadata_record_update (bool) – False (default): read metadata records of all files and import into StrongLink afterward; True: import each metadata record after it has been read

  • json_string (str) – provide a json string instead of a json file; incompatible with json_file

Returns:

metadata import summary (key ‘header’)

Return type:

dict