Skip to main content

Document Insighter Python Client

Project description

Document Insighter Python Client

document-insighter is a set of tools that enables developers to interactive with Document Insighter API, like query extraction results.

Installation

pip install document-insighter

Getting Started

Configure ENV variables

# Client application credentials
INSIGHTER_CLIENT_IDP=xxxx
INSIGHTER_CLIENT_ID=xxxx
INSIGHTER_CLIENT_SECRET=xxxx

# Client access token file path
INSIGHTER_CLIENT_TOKEN_PATH=insighter_token.json

Fetch Token

from document_insighter.api_client import DocumentInsighter
from document_insighter.model import Env, Extraction

# Change to Env.PRODUCTION for production
document_insighter = DocumentInsighter(Env.STAGING)
document_insighter.fetch_token()

Query Extractions

from datetime import datetime

pages_generator = document_insighter.query_extractions_pages(datetime(2022, 4, 13), datetime(2022, 4, 14), page_size=50)
extraction_dicts = [x for page in pages_generator for x in page]

# read first extraction
sections = extraction_dicts[0].get('data').get('sections')
batch_sections = list(filter(lambda x:x.get('category') == 'coa_batch', sections))
aggregation_sections = list(filter(lambda x:x.get('category') == 'coa_aggregation', sections))
# load json to models
from typing import List
extractions: List[Extraction] = [Extraction.from_dict(x) for x in extraction_dicts]

License

MIT

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

document-insighter-0.0.6.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

document_insighter-0.0.6-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file document-insighter-0.0.6.tar.gz.

File metadata

  • Download URL: document-insighter-0.0.6.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for document-insighter-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c330da75b56505f990bfaae8e8c62f12d67bd0c8b34731ecd1fcca6368228168
MD5 61e2ef36e11bfc77e977d6e4da13d19d
BLAKE2b-256 8c47e904a566018ad3684e6332c0e44c9c564a2dfc6f9ed1b6c955cc9a72841f

See more details on using hashes here.

File details

Details for the file document_insighter-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for document_insighter-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fa50077c097be140affb76dcbf2373cf66e35080747ee5721507fda246e47f7d
MD5 6072b8f5e6bdaf423797233f06fdec35
BLAKE2b-256 3b86bc8a4816fd40eea74885495bd6cd2aef055b41745f6222e392264cf4223f

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