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.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for document-insighter-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ce350d4425addc94291cefba6e6a82ba503a26a7ca9663111fb8943353d4da9d
MD5 9a0193297b8cabbde0b83eebca685086
BLAKE2b-256 231538d0f7887badc6c1bbe0182cfdf0d00ecd9a4d36a9a439f7dc6464077dde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for document_insighter-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a69d06830a3341c7c453faa9151ccdb70aeadaa7c9bad97b0b5bb82bdf11e7
MD5 708384e9f070e547d7e1ec4866f506e2
BLAKE2b-256 d7bd32cf710e0fa7848c1b0c2a57ee72c3a0a72890cd149b01b75d9f0a702db5

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