Package: mindee
Mindee API Helper Library for PythonQuickly and easily connect to Mindee's API services using Python.Quick StartHere's the TL;DR of getting started.First, get anAPI KeyThen, install this library:pipinstallmindeeFinally, Python away!Loading a File and Parsing ItGlobal DocumentsfrommindeeimportClient,product# Init a new clientmindee_client=Client(api_key="my-api-key")# Load a file from diskinput_doc=mindee_client.source_from_path("/path/to/the/file.ext")# Parse the document as an invoice by passing the appropriate typeresult=mindee_client.parse(product.InvoiceV4,input_doc)# Print a brief summary of the parsed dataprint(result.document)Note:Files can also be loaded from:A pythonBinaryIOcompatible file:input_doc=mindee_client.source_from_file(my_file)A URL (HTTPSonly):input_doc=mindee_client.source_from_url("https://files.readme.io/a74eaa5-c8e283b-sample_invoice.jpeg")A base64-encoded string, making sure to specify the extension of the file name:input_doc=mindee_client.source_from_b64string(my_input_string,"my-file-name.ext")Raw bytes, making sure to specify the extension of the file name:input_doc=mindee_client.source_from_bytes(my_raw_bytes_sequence,"my-file-name.ext")Region-Specific DocumentsfrommindeeimportClient,product# Init a new clientmindee_client=Client(api_key="my-api-key")# Load a file from diskinput_doc=mindee_client.source_from_path("/path/to/the/file.ext")# Parse the document as a USA bank check by passing the appropriate typeresult=mindee_client.parse(product.us.BankCheckV1,input_doc)# Print a brief summary of the parsed dataprint(result.document)Custom Document (API Builder)frommindeeimportClient,product# Init a new clientmindee_client=Client(api_key="my-api-key")# Add your custom endpoint (document)my_endpoint=mindee_client.create_endpoint(account_name="my-account",endpoint_name="my-endpoint",)# Load a file from diskinput_doc=mindee_client.source_from_path("/path/to/the/file.ext")# Parse the file.# The endpoint must be specified since it cannot be determined from the class.result=mindee_client.parse(product.CustomV1,input_doc,endpoint=my_endpoint)# Print a brief summary of the parsed dataprint(result.document)# Iterate over all the fields in the documentforfield_name,field_valuesinresult.document.fields.items():print(field_name,"=",field_values)Additional OptionsOptions to pass when sending a file.Page OptionsAllows sending only certain pages in a PDF.In this example we only send the first, penultimate and last pages:frommindeeimportClient,product,PageOptionsresult=mindee_client.parse(product.InvoiceV4,input_source,page_options=PageOptions(page_indexes=[0,-2,-1],operation=PageOptions.KEEP_ONLY,on_min_pages=2))Further ReadingComplete details on the working of the library are available in the following guides:Getting startedPython Command Line Interface (CLI)Python Custom APIs (API Builder)Python Invoice OCRPython International Id OCRPython Resume OCRPython Receipt OCRPython Financial Document OCRPython Passport OCRPython Proof of Address OCRPython EU License Plate OCRPython US Driver License OCRPython FR Bank Account Detail OCRPython FR Carte Grise OCRPython FR Carte Vitale OCRPython FR ID Card OCRPython FR Petrol Receipts OCRPython US Bank Check OCRPython US W9 OCRPython US Driver License OCRPython Barcode Reader APIPython Cropper APIPython Invoice Splitter APIPython Multi Receipts Detector APIYou can view the source code onGitHub.You can also take a look at theReference Documentation.LicenseCopyright © MindeeAvailable as open source under the terms of theMIT License.Questions?Join our Slack