Skip to main content

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

Project description

Resistant documents client

This library provides a Python client for a Resistant.ai document forgery analysis service. For a detailed description of the API please see API reference docs.

Prerequisites

During the customer onboarding process, you should be provided with the following:

  • API_KEY : str

Basic usage

Submit a document for analysis with default pipeline configuration.

from bp_pdf_forgery_client.client import BpPdfForgeryClient

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

print(report)

Customized usage

Submit a document for analysis with customized process parameters or select a different type of analysis.

Step 1: Create a client with your credentials

client = BpPdfForgeryClient(api_key="API_KEY")

Step 2: 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

Step 3: Retrieve analysis result

You can retrieve only those types of analysis which were requested in the previous step as pipeline_configuration option.

result_fraud = 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 the client will 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.

Step 4: Pre-signed url [Optional]

This method lets you generate a link for anybody else to access the analysis result.

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

Parameters:

  • expiration- specifies a validity duration (in seconds) of the generated link, min: 1, max: 604800 seconds (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.0.0.tar.gz (5.2 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.0.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file resistant_documents_client-1.0.0.tar.gz.

File metadata

  • Download URL: resistant_documents_client-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 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.0.0.tar.gz
Algorithm Hash digest
SHA256 1cf5d6a8287058facd9f04f17fb8cc22130b7d3c5083666ea6e805583c086310
MD5 cb3d144f767a705d0691f3eca579faee
BLAKE2b-256 89a4fa3928982a1cb5d00555d1f270ade46000cefbc8a3006c0f9327b69f0e97

See more details on using hashes here.

File details

Details for the file resistant_documents_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for resistant_documents_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ab0cb3368c0b54d7d79fa9ffe5c3c35074fd0fe13348bd30baebab023036d24
MD5 480b24b03acf11aebb3b8721821d5bd3
BLAKE2b-256 7769393688e0843a77e00f136802d167406f70274dde851ed719f6743af5670d

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