Metadata-Version: 2.1
Name: mindee
Version: 4.0.0
Summary: Mindee API helper library for Python
Home-page: https://mindee.com/
Author: Mindee
Author-email: opensource@mindee.com
License: MIT
Project-URL: Documentation, https://developers.mindee.com/docs/python-sdk
Project-URL: Source, https://github.com/publicMindee/mindee-api-python
Platform: any
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pikepdf ~=6.2
Requires-Dist: pytz >=2023.3
Requires-Dist: requests ~=2.31
Provides-Extra: build
Requires-Dist: build ~=0.9 ; extra == 'build'
Requires-Dist: twine ~=4.0 ; extra == 'build'
Provides-Extra: dev
Requires-Dist: black ==23.1.0 ; extra == 'dev'
Requires-Dist: mypy ==1.4.1 ; extra == 'dev'
Requires-Dist: pip-tools ~=6.14 ; extra == 'dev'
Requires-Dist: pylint ==2.17.1 ; extra == 'dev'
Requires-Dist: setuptools ==51.3.3 ; extra == 'dev'
Requires-Dist: isort ==5.11.5 ; extra == 'dev'
Requires-Dist: pre-commit ~=2.21.0 ; extra == 'dev'
Requires-Dist: pydocstyle ==6.3.0 ; extra == 'dev'
Requires-Dist: types-pytz ~=2023.3 ; extra == 'dev'
Requires-Dist: types-requests ~=2.31 ; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx ~=5.3 ; extra == 'docs'
Requires-Dist: sphinx-rtd-theme ~=1.1 ; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints ~=1.20 ; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest ~=7.1 ; extra == 'test'
Requires-Dist: pytest-cov ~=4.0 ; extra == 'test'

[![License: MIT](https://img.shields.io/github/license/mindee/mindee-api-python)](https://opensource.org/licenses/MIT) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mindee/mindee-api-python/test.yml)](https://github.com/mindee/mindee-api-python) [![PyPI Version](https://img.shields.io/pypi/v/mindee)](https://pypi.org/project/mindee/) [![Downloads](https://img.shields.io/pypi/dm/mindee)](https://pypi.org/project/mindee/)

# Mindee API Helper Library for Python
Quickly and easily connect to Mindee's API services using Python.

## Quick Start
Here's the TL;DR of getting started.

First, get an [API Key](https://developers.mindee.com/docs/create-api-key)

Then, install this library:
```shell
pip install mindee
```

Finally, Python away!

### Loading a File and Parsing It

#### Global Documents
```python
from mindee import Client, product

# Init a new client
mindee_client = Client(api_key="my-api-key")

# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")

# Parse the document as an invoice by passing the appropriate type
result = mindee_client.parse(product.InvoiceV4, input_doc)

# Print a brief summary of the parsed data
print(result.document)
```

**Note:** Files can also be loaded from:

A python `BinaryIO` compatible file:
```python
input_doc = mindee_client.source_from_file(my_file)
```

A URL (`HTTPS` only):
```python
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:
```python
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:
```python
input_doc = mindee_client.source_from_bytes(my_raw_bytes_sequence, "my-file-name.ext")
```

#### Region-Specific Documents
```python
from mindee import Client, product

# Init a new client
mindee_client = Client(api_key="my-api-key")

# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")

# Parse the document as a USA bank check by passing the appropriate type
result = mindee_client.parse(product.us.BankCheckV1, input_doc)

# Print a brief summary of the parsed data
print(result.document)
```

#### Custom Document (API Builder)

```python
from mindee import Client, product

# Init a new client and add your custom endpoint (document)
mindee_client = Client(api_key="my-api-key")
custom_endpoint = mindee_client.create_endpoint(
    account_name="john",
    endpoint_name="wnine",
)

# Load a file from disk
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")

# Parse the file.
# The endpoint must be specified since it can't be determined from the class.
result = parse(product.CustomV1, endpoint=custom_endpoint)

# Print a brief summary of the parsed data
print(result.document)

# Iterate over all the fields in the document
for field_name, field_values in result.document.fields.items():
    print(field_name, "=", field_values)
```

### Additional Options
Options to pass when sending a file.

#### Page Options
Allows sending only certain pages in a PDF.

In this example we only send the first, penultimate and last pages:

```python
api_response = mindee_client.parse(
    mindee.product.InvoiceV4,
    input_source,
    page_options=mindee.PageOptions(
        page_indexes=[0, -2, -1],
        operation: mindee.PageOptions.KEEP_ONLY,
        on_min_pages=2
    )
)
```

## Further Reading
Complete details on the working of the library are available in the following guides:

* [Getting started](https://developers.mindee.com/docs/python-getting-started)
* [Python Command Line Interface (CLI)](https://developers.mindee.com/docs/python-cli)
* [Python Custom APIs (API Builder)](https://developers.mindee.com/docs/python-api-builder)
* [Python Invoice OCR](https://developers.mindee.com/docs/python-invoice-ocr)
* [Python Receipt OCR](https://developers.mindee.com/docs/python-receipt-ocr)
* [Python Financial Document OCR](https://developers.mindee.com/docs/python-financial-document-ocr)
* [Python Passport OCR](https://developers.mindee.com/docs/python-passport-ocr)
* [Python Proof of Address OCR](https://developers.mindee.com/docs/python-proof-of-address-ocr)
* [Python EU License Plate OCR](https://developers.mindee.com/docs/python-eu-license-plate-ocr)
* [Python FR Bank Account Detail OCR](https://developers.mindee.com/docs/python-fr-bank-account-details-ocr)
* [Python FR Carte Grise OCR](https://developers.mindee.com/docs/python-fr-carte-grise-ocr)
* [Python FR Carte Vitale OCR](https://developers.mindee.com/docs/python-fr-carte-vitale-ocr)
* [Python FR ID Card OCR](https://developers.mindee.com/docs/python-fr-id-card-ocr)
* [Python FR Petrol Receipts OCR](https://developers.mindee.com/docs/python-fr-petrol-receipts-ocr)
* [Python US Bank Check OCR](https://developers.mindee.com/docs/python-us-bank-checks-ocr)
* [Python US W9 OCR](https://developers.mindee.com/docs/python-us-w9-ocr)
* [Python US Driver License OCR](https://developers.mindee.com/docs/python-us-driver-license-ocr)
* [Python Barcode Reader API](https://developers.mindee.com/docs/python-barcode-reader-api)
* [Python Cropper API](https://developers.mindee.com/docs/python-cropper-api)
* [Python Invoice Splitter API](https://developers.mindee.com/docs/python-invoice-splitter-api)
* [Python Multi Receipts Detector API](https://developers.mindee.com/docs/python-multi-receipts-detector-api)

You can view the source code on [GitHub](https://github.com/mindee/mindee-api-python).

You can also take a look at the
**[Reference Documentation](https://mindee.github.io/mindee-api-python/)**.

## License
Copyright © Mindee

Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
