magika
magika copied to clipboard
how to list all possible format types in python?
In the web demo, I am able to see all kinds of possible formats in descending order. Is there any way to get these in python?
For now, I am seeing only the top category format with score.
Here is my python code.
result = magika.identify_path(Path(root_folder + "\\" + file_path))
confidence = "{:.2f}%".format(result.output.score * 100)
print({"Filepath": file_path, "File type": str(result.output.ct_label),
"File Description": str(result.output.magic), "Description": str(result.output.description),
"Mime Type": str(result.output.mime_type),
"Group": str(result.output.group), "Confidence": str(confidence)})