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 two strings to perform further steps. Both you receive during the customer onboarding process.

  • CLIENT_ID
  • CLIENT_SECRET

Basic usage

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

from resistant_documents_client.client import ResistantDocumentsClient

client = ResistantDocumentsClient(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")
with open("local_file.pdf", "rb") as fp:
    report = client.analyze(fp.read(), query_id="local_file.pdf")
print(report["score"])

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 = ResistantDocumentsClient(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")

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_content = client.content(submission_id=submission_id)
result_fraud = client.content(submission_id=submission_id)
result_quality = client.quality(submission_id=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.

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-2.0a0.tar.gz (5.5 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-2.0a0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: resistant_documents_client-2.0a0.tar.gz
  • Upload date:
  • Size: 5.5 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-2.0a0.tar.gz
Algorithm Hash digest
SHA256 969df1ed891e464a7fe33c2395eef92af292b18247579585d0160142c3f87d76
MD5 e0e3ebd57bec4bda090dec30be9ab2aa
BLAKE2b-256 7c302780219dbe3231c02c0a88d1e1c79bfb6fafb2b921b989e53072e1c041d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for resistant_documents_client-2.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ae46507830514b2e9b267adb3169ed1cb28720f2a3d44ef9643720c01742577
MD5 f8412e3c0026ee86082105f35a52a8fd
BLAKE2b-256 15caee2c24f22b50dec44d87d991592ec370be50b0092ef5d20fb288b27f39a3

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