Skip to main content

Amazon Textract Caller tools

Project description

Textract-Caller

amazon-textract-caller provides a collection of ready to use functions and sample implementations to speed up the evaluation and development for any project using Amazon Textract.

Making it easy to call Amazon Textract regardless of file type and location.

def call_textract(input_document: Union[str, bytearray],
                  features: List[Textract_Features] = None,
                  output_config: OutputConfig = None,
                  kms_key_id: str = None,
                  job_tag: str = None,
                  notification_channel: NotificationChannel = None,
                  client_request_token: str = None,
                  return_job_id: bool = False,
                  force_async_api: bool = False) -> str:

Samples

Calling with file from local filesystem only OCR

textract_json = call_textract(input_document="/folder/local-filesystem-file.png")

Calling with file from local filesystem only OCR and using in Textract Response Parser

(needs trp dependency throughpython -m pip install amazon-textract-response-parser)

import json
from trp import Document
from textracthelper.t_call call_textract

textract_json = call_textract(input_document="/folder/local-filesystem-file.png")
d = Document(json.loads(response))

Calling with file from local filesystem with TABLES features

from textracthelper.t_call call_textract, Textract_Features
features = [Textract_Features.TABLES]
response = call_textract(
    input_document="/folder/local-filesystem-file.png", features=features)

Call with images located on S3 but force asynchronous API

from textracthelper.t_call call_textract
response = call_textract(input_document="s3://some-bucket/w2-example.png", force_async_api=True)

Call with OutputConfig, Customer-Managed-Key

from textracthelper.t_call call_textract
from textractcaller.t_call import OutputConfig, Textract_Features
output_config = OutputConfig(s3_bucket="somebucket-encrypted", s3_prefix="output/")
response = call_textract(input_document="s3://someprefix/somefile.png",
                          force_async_api=True,
                          output_config=output_config,
                          kms_key_id="arn:aws:kms:us-east-1:12345678901:key/some-key-id-ref-erence",
                          return_job_id=False,
                          job_tag="sometag",
                          client_request_token="sometoken")

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

amazon-textract-caller-0.0.3.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amazon_textract_caller-0.0.3-py2.py3-none-any.whl (9.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file amazon-textract-caller-0.0.3.tar.gz.

File metadata

  • Download URL: amazon-textract-caller-0.0.3.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for amazon-textract-caller-0.0.3.tar.gz
Algorithm Hash digest
SHA256 25dfe71136eb8260dad8bc6395a960d57ef8259805c54e8b38e77afb4792f54e
MD5 61086518549195590127184d58f27d9a
BLAKE2b-256 930881daf4075e0b1ed0e61da29b7243a860ca5e2da977f66da9faec5a52047c

See more details on using hashes here.

File details

Details for the file amazon_textract_caller-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: amazon_textract_caller-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for amazon_textract_caller-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cd9d17d3c2d64eaff5daeaeba6de9c28dfab7b24ba2ac59b9b4b380dde04b65c
MD5 d232ef1424e8499c449ac58267d0c753
BLAKE2b-256 d6dda6a61db085949999a29439cadb4d756679d7fdfbbb0d9a45bf96c5035d93

See more details on using hashes here.

Supported by

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