Python interface to Basylic's API
Project description
basylic-python-client
Module to access Basylic API.
Summary
Developed by ETAONIS, Basylic is a SaaS solution performing document fraud detection with "state-of-the-art" performances. The solution is also used as a powerful tool to extract information from documents. This module provides a Python interface for accessing Basylic.
Installation
This module is available on PyPI. You can install it with pip
command:
pip install basylic
Alternatively, you can access the module source code on GitHub:
Basic usage
To access the API, refresh and access tokens should be provided. You
can access your Refresh token via the Portal interface. Then, we
recommend you store its value in the environment variable
BASYLIC_REFRESH_TOKEN
.
from basylic import Basylic
basylic = Basylic()
Alternatively, if your refresh token is stored in a non-standard
location, you can specify its value with argument refresh_token
during class instantiation:
from basylic import Basylic
basylic = Basylic(refresh_token=...)
- At least two arguments should be set: one of
file_path
,file_obj
orftp_file
, anddocument_type
:
basylic.send_document(file_path="corinne-berthier-recto-verso.pdf", document_type="french_ids")
- The
file_path
argument is a string with the document path (e.g.: "~/FILE.pdf") document_type
is a string specifying which Basylic API to call (e.g.: "french_ids")
Possible values for document_type
are: 'french_ids'
, 'rib'
, 'ri'
, 'avis-imposition'
...
With those arguments specified, send_document
returns a comprehensive JSON document.
- Data about applicants can also be joined to the API call:
applicants_information = {"applicant_0": {"identity": "BERTHIER CORINNE"}}
basylic_result = basylic.send_document(
file_path="corinne-berthier-recto-verso.pdf",
document_type="french_ids", applicants_information=applicants_information)
print(basylic_result)
- And various arguments could be passed as kwargs. For example:
- a.
save_report=True
will save the result of your request in your user space on Basylic Portal; - b.
with_image=True
will return a base64 image for each recognised document;
For example, this code:
applicants_information = {"applicant_0": {"identity": "BERTHIER CORINNE"}}
basylic_result = basylic.send_document(
file_path="corinne-berthier-recto-verso.pdf",
document_type="french_ids", applicants_information=applicants_information,
with_image=True, save_report=True)
print(basylic_result)
will act in the following way:
- Uploads of document whose path is
file_path
to Basylic servicefrench_ids
; - Produces of a JSON document
basylic_result
with all relevant information; - Compares
identity
provided and identity extracted by Basylic OCR; - A base64 encoded image will be returned in the approriate key of
basylic_result
.
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 basylic-0.22.0.tar.gz
.
File metadata
- Download URL: basylic-0.22.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ecdca05a71c9d805473342a5fbadda5af42b821aa2ef80b81cf19b51972d9bd |
|
MD5 | e51718eaee1033ad97ec882a5e377482 |
|
BLAKE2b-256 | 2a99bfc977bb1188855ef939d0e056849124e6355159c6fddbbc6feec9d1a449 |
File details
Details for the file basylic-0.22.0-py3-none-any.whl
.
File metadata
- Download URL: basylic-0.22.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab12feb2b9c8cc149453badb73a6b375c98b4e2cdc17817a0a9143fe955f350f |
|
MD5 | 8bbf951f67c7932c50259d8640ab059e |
|
BLAKE2b-256 | f2444400741a87eecd518ee3eb14fcb636d1fbe7672f3627cb175518e9c5158e |