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
# 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)
extractions = [x for page in pages_generator for x in page]
# read first extraction
sections = extractions[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))
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file document-insighter-0.0.4.tar.gz
.
File metadata
- Download URL: document-insighter-0.0.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da26dcf8d8f44b4e00e73c70b7c51c98ebd68b955efb6cf65d207df731e3c588 |
|
MD5 | a85bb4eab05340f2734183d222833e3d |
|
BLAKE2b-256 | 8b1887408fe20b4c88e986984eecd6959675321acaf3f50cab4d5967ce4bc5fa |
File details
Details for the file document_insighter-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: document_insighter-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdabfd1d12b7980c3983d8fc048eb123e0599bb2a8e964e844c8759ae47fd148 |
|
MD5 | bb89e28ee0e19f1ba1d5d5681c5302ea |
|
BLAKE2b-256 | a5d9a1afbfab67b5c4dfa8211bfe3170b8f86db2dc07f2fc831cf69122e2f6ab |