Blog
Product News

New Release: Python SDK V2

Reading time:
2
min
Published on:
Feb 24, 2022

Favour Kelvin

Favour Kelvin

Summary

Share the article

We recently released a new version of the Python SDK. We’re working hard to improve the experience of our developers and we heard your feedback— here’s a quick overview:

What is the v2 Python SDK?

If you’re already familiar with our Python SDK, then you know that our first version (v1) supports the Off-the-shelf APIs Invoice, Passport, and Receipt APIs, including Europe license plates. We have made various updates and improvements to this throughout the course of time. Custom documents APIs created using the API builder are now supported by the V2 python SDK.

Why should you upgrade to v2?

Simply put, because the developer experience is much better and it supports a wider range of documents!

The installation process is the same as v1:

pip install mindee

To briefly illustrate the use of the SDK, here’s is an example of the implementation differences between v1 and v2:

For extracting documents from the off-the-shelf APIs(invoice), you’d write the following in v1:

from mindee import Client

mindee_client = Client(invoice_token="your_invoices_api_key_here")

invoice_data = mindee_client.parse_invoice("/path/to/file")

Whereas in v2

from mindee import Client

mindee_client = Client().config_invoice("my-invoice-api-key")

api_response = mindee_client.
    doc_from_path("/path/to/the/invoice.pdf").parse("invoice")

print(api_response.invoice)

For Custom document built API created using the API builder, in v2 you can use the following code:

# Init a new client and configure your custom document
from mindee import Client
mindee_client = Client().config_custom_doc(
      document_type="pokemon-card",
      singular_name="card",
      plural_name="cards",
      account_name="pikachu",
      api_key="pokemon-card-api-key"
)

# Load a file from disk and parse it
api_response = mindee_client.
    doc_from_path("/path/to/the/card.jpg").parse("pokemon-card")

# Print a brief summary of the parsed data
print(api_response.card)

To make it easier to transition from v1 to v2, check out our documentation for more details.

Extra perks with V2!

We have released v2.0.0, v2.0.1 and v2.0.2. While these releases provide support for custom documents API created using the API Builder, it also has a few changes:

v2.0.0

  • now has confidence renamed to probability in the return fields to match API return
  • now has client initialization reworked to be more extensible
  • now has Document loading and parsing reworked to separate arguments

v2.0.1

  • have improved the converting of invoice to string
  • have improved the counting of empty PDF pages
  • has an updated version of PikePDF
  • has an updated version of Pillow for extra security.

v2.0.2

  • have improved the sending financial document via the CLI
  • now allows OCR return in CLI
  • makes that sure all of the document information is printed

We’re excited to see what you will create with our new and improved Python SDK!

Conclusion

Want to give the new SDK version a spin? Head on over to our Python SDK section in our documentation. Have any feedback or questions you’d like to see us know? Join us in our Slack community — we’d love to hear from you!

API Builder
Mindee
OCR
Python
SDK
logo Mindee

Schedule a meeting with one of our experts

Please provide the following information so we can connect you to the right teammate.

Oops! Something went wrong while submitting the form.