Skip to main content

A simple API handler for Python

Project description

Acodis API Handler

This package provides easy to use python classes and functions to communicate with Acodis API (https://acodis.io). Acodis is an IDP solution that focuses on extracting and structuring complex documents (PDFs, Images)

Installation

pip install AcodisApiHandler

Usage

This package is particularly useful for programmatic access, since ACODIS' API structure requires a different user and password for every export step. Hence, if you have to manage multiple exports (e.g. multiple workflows), you just need to update the main class user and password attribute, and call the authenticate() method.

from AcodisApiHandler import AcodisApiHandler

# Set up your credentials
ACODIS_BASE_URL = "https://<YOUR-ACOIDS-INSTANCE-URL>/workbench/api/transaction"
ACODIS_USER = "<YOUR-EXPORT-USERNAME>"
ACODIS_PASSWORD = "<YOUR-EXPORT-PASSWORD>"

# Create an instance of the AcodisApiHandler class
handler = AcodisApiHandler(ACODIS_BASE_URL)

# Set the credentials
handler.user = ACODIS_USER
handler.password = ACODIS_PASSWORD

# Authenticate with the API
handler.authenticate()

handler.workflow(pdf_path="<PATH-TO-PDF-FILE>")

# The extraction result is an ElementTree XML object stored in the handler.result variable
# You can check it by:
print(handler.result)

Utils

This package also provides some utils to help you with the extraction process.

Extracting tagged data points

Tags are used to identify the data points that you want to extract from the document. This function will create a dictionary with the tags as keys and the extracted data as values.

from AcodisApiHandler import extract_tags

tags_list = ["example_tag_1", "example_tag_1", "example_tag_1"]

# Using the precviously created handler instance
tagged_data = extract_tags(handler, tags_list)

If we print the tagged_data variable we will get:

{
    "example_tag_1": "Example data 1",
    "example_tag_2": "Example data 2",
    "example_tag_3": "Example data 3"
}

License

MIT

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Roadmap

  • Additional utils: parsing tables, extracting images, etc.
  • Add unit tests
  • Add batch processing and parallelization

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AcodisApiHandler-0.3.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

AcodisApiHandler-0.3.3-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file AcodisApiHandler-0.3.3.tar.gz.

File metadata

  • Download URL: AcodisApiHandler-0.3.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for AcodisApiHandler-0.3.3.tar.gz
Algorithm Hash digest
SHA256 5f7949f75fb6adb75321bdfb8fc3a26fb4f45a24c40df00dc24b485f899f9fc3
MD5 9388f0ab3de3bbbd01bd0cab36c7017c
BLAKE2b-256 f0363e9ad663ca0b2ed13835a78261e0673b801772d7d6d4cb5b0f4a1050d646

See more details on using hashes here.

File details

Details for the file AcodisApiHandler-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for AcodisApiHandler-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bd2eb89ab8c1451b70aaff51cb21f8eefa1824ae6724c3721d064c05ceaa38b1
MD5 c7a392cb08d6459a8d0bb03d181e7b1b
BLAKE2b-256 fec2430d489fb75f06efd753edab6d228568d07ed1ebc7bc6823e5b0b33354b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page