Skip to main content

Resistant.ai document forjerry python client for convenient integration with REST API service.

Project description

Resistant documents client

This tool facilitates communication with the resistant.ai document forjerry analysis service using Python. Here you can find a description of the underlying REST service. Below we describe the Python interface. For a detailed description, go directly to the referenced API docs.

Prerequisites

You will need one string to perform further steps which you receive during the customer onboarding process.

  • API_KEY

Basic usage

The following example runs fraud analysis on a given document. It is the most usual usage of the API.

from bp_pdf_forgery_client.client import BpPdfForgeryClient

client = BpPdfForgeryClient(api_key="YOUR_API_KEY")
with open("local_file.pdf", "rb") as fp:
    report = client.analyze(fp.read(), query_id="local_file.pdf")

print(report)

Customized usage

Suppose you want to customize parameters of the process or perform another type of analysis. Below we describe what are the particular steps which you have to run.

Create client with you credentials

client = BpPdfForgeryClient(api_key="YOUR_API_KEY")

Create submission with pipeline setup

with open("local_file.pdf", "rb") as fp:
    my_submission_id = client.submit(fp.read(), query_id="local_file.pdf", pipeline_configuration="CONTENT_AFTER_FRAUD_AFTER_QUALITY")

Possible pipeline configurations are listed in REST API docs.

Retrieve analysis result

You can retrieve only those types of analysis which were specified in previous pipeline_configuration.

result_results = client.results(submission_id=my_submission_id)
result_content = client.content(submission_id=my_submission_id)
result_quality = client.quality(submission_id=my_submission_id)

print(result_content)
print(result_fraud)
print(result_quality)

These methods also accept max_num_retries, which represents how many times will the client poll the server before failing (because the communication is asynchronous). It might be customized but has a default value. Other parameters correspond to the ones in the REST API docs.

Presigned url

data = client.presign(submission_id=my_submission_id, expiration=600)
presigned_url = data["presigned_url"]

This method lets you generate a link for anybody else to access the analysis result. You can set expiration to this temporary generated link in the parameter expiration. Note that the value is in seconds with lower bound 1 and upper bound 604800 (one week).

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

resistant_documents_client-1.0a0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

resistant_documents_client-1.0a0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file resistant_documents_client-1.0a0.tar.gz.

File metadata

  • Download URL: resistant_documents_client-1.0a0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.0 Darwin/21.2.0

File hashes

Hashes for resistant_documents_client-1.0a0.tar.gz
Algorithm Hash digest
SHA256 77d414472f022a07a9726f3805b0bc699999926901742c8caf5e6f90f7f827d3
MD5 cb329ec64dc312db43ca88cf1c977610
BLAKE2b-256 3070fda66e6007e4e8e750803515dc5e4368ca2c47a486213dc55ddbaf708a72

See more details on using hashes here.

File details

Details for the file resistant_documents_client-1.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for resistant_documents_client-1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f618f28068abd99a19491fb118ed4bfb2adad799dedfafd753fb725208cdd5c
MD5 652fa8adff0f42181864d3b9d108031c
BLAKE2b-256 151c07c24fec30a265b0c4e19ab72c5af9212ecc243cf5ffa3c9d2a61c78ebd1

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