Metadata-Version: 2.1
Name: idcloud-python
Version: 0.5.0
Summary: API Client communicating with THALES IdCloud REST API.
Home-page: https://github.com/idcloud-python
Author: Backbone s.r.o.
Author-email: office@backbone.sk
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Database
Classifier: Topic :: Security
Description-Content-Type: text/markdown
Requires-Dist: python-dotenv (==0.18.*)
Requires-Dist: requests (==2.26.*)
Requires-Dist: pyjwt (==2.1.*)
Requires-Dist: cryptography (==3.*)

# idcloud-python

API Client communicating with THALES IdCloud REST API.

## Installation

```shell
# pip
pip install idcloud-python

# pipenv
pipenv install idcloud-python

# poetry
poetry add idcloud-python
```

## Example

### 1. Create Environment object

```python
from idcloud.configuration import Environment

environment = Environment(name='test-api', api_url='http://127.0.0.1:8000/')
```

---

### 2. Create Configuration object

```python
from idcloud.configuration import Configuration

configuration = Configuration(
    environment=environment,
    api_key='0e5e171f-1163-4277-9b48-68c3ba5816be',
    tenant_id='tenant-tenant-123',
    jti='tenant-jti',
    aud='tenant-aud',
    iss='tenant-iss',
    jwt_key_file='path-to-jwt-secret-key',
    mtls=(
        'path-to-mtls-cert',
        'path-to-mtls-key'
    ),
    roles=["scs:executeScenario"]
)
```

### 3. Create ApiClient object

```python
from idcloud.api_client import ApiClient

api_client = ApiClient(configuration=configuration)
```

### 4. Example Connect Verify Document

```python
from idcloud.enums.capture_method import CaptureMethod
from idcloud.enums.document_type import DocumentType
from idcloud.enums.status import Status


scenario = api_client.connect_verify_document.initiate_document_verification(
    front_white_image=image_data['front'],
    capture_method=CaptureMethod.MOBILE,
    document_type=DocumentType.ID
)

result = api_client.connect_verify_document.verify_results(scenario.id)

if result.status == Status.FINISHED:
    print('Process finished.')
elif result.status in [Status.WAITING, Status.RUNNING]:
    print('Verify results later, when finished.')
elif result.status in [Status.FAILURE, Status.ERROR]:
    print('Handle error or failure.')
```

## Tests

To run tests, you need to run command: `pytest`

Tests require access data to the api. For security reasons, access data is stored in environment variables. To set
environment variables, you need to create an `.env` file from the example in the `.env.example` file.

---
Developed by [BACKBONE s.r.o.](https://www.backbone.sk/) with ❤️ and ☕️, 2021 (C)

# CHANGELOG

## 0.5.0 : 2021-09-10

- Removed ForbiddenException and added more exception scenarios to the Requestor object.

## 0.4.0 : 2021-09-09

- Requestor now returns ResponseSnapshot object containing request response body and headers.

## 0.3.2 : 2021-08-30

- Fixed mtls checking in requestor and renamed environment variables.

## 0.3.1 : 2021-08-26

- Fixed missing cryptography dependency in `setup.py`

## 0.3.0 : 2021-08-25

- MTLS support
- JWT token creation
- `ForbiddenException` (if problem with process steps or feature is not allowed by Thales)

## 0.2.3 : 2021-08-05

- Fixed raw_response scenario attribute to be json serializable

## 0.2.2 : 2021-08-05

- Added IdCloudException

## 0.2.1 : 2021-08-05

- Fixed including CHANGELOG.md

## 0.2.0 : 2021-08-04

- Added required packages to the setup file

## 0.1.0 : 2021-07-23

- Initial release


