Skip to main content

SDK for Acrosure api

Project description

# Acrosure Python SDK

![Acrosure](./static/Acrosure-color.png)

Python version 2 and 3 SDK for connecting with Acrosure Insurance Gateway

## Installation

Install via pip:

`pip install acrosure_sdk`

## Requirements

* Python 2.7.1+
* `requests` library

## Getting Started

Import AcrosureClient into your project.

```python
from acrosure_sdk import AcrosureClient

```

Instantiate with an API key from [Acrosure Dashboard](https://dashboard.acrosure.com).


```python
acrosure_client = AcrosureClient(token = '<your_api_key>')
```

## Basic Usage

AcrosureClient provides several objects such as `application`, `product`, etc. and associated APIs.

Any data will be inside an response object with `data` key, along with meta data, such as:

```json
{
"data": { ... },
"status": "ok",
...
}
```

### Application

#### Get

Get application with specified id.

```python
application = acrosure_client.application.get('<application_id>')
```

#### Create

Create an application.

```python
created_application = acrosure_client.application.create(
productId = '<product_id>', # required
basic_data = {},
package_options = {},
additional_data = {},
package_code = '<package_code>',
attachments = []
)
```

#### Update

Update an application.

```python
updatedApplication = acrosure_client.application.update(
application_id = '<application_id>', # required
basic_data = {},
package_options = {},
additional_data = {},
package_code = '<package_code>',
attachments = []
)
```

#### Get packages

Get current application available packages.

```python
packages = acrosure_client.application.get_packages(
'<application_id>'
)
```

#### Select package

Select package for current application.

```python
updated_application = acrosure_client.application.select_package(
application_id = '<application_id>',
package_code = '<package_code>'
)
```

#### Get package

Get selected package of current application.

```python
current_package = acrosure_client.application.get_package(
'<application_id>'
)
```

#### Get 2C2P hash

Get 2C2P hash.

```python
returned_hash = acrosure_client.application.get_2c2p_hash(
application_id = '<application_id>',
args = '<arguments>'
)
```

#### Submit

Submit current application.

```python
submitted_application = acrosure_client.application.submit(
'<application_id>'
)
```

#### Confirm

Confirm current application.

_This function needs secret API key._

```python
confirmed_application = acrosure_client.application.confirm(
'<application_id>'
)
```

#### List

List your applications (with or without query).

```python
applications = acrosure_client.application.list(query)
```

### Product

#### Get

Get product with specified id.

```python
product = acrosure_client.product.get('<product_id>')
```

#### List

List your products (with or without query).

```t
products = acrosure_client.product.list(query)
```

### Policy

#### Get

Get policy with specified id.

```python
policy = acrosure_client.policy.get('<policy_id>')
```

#### List

List your policies (with or without query).

```python
policies = acrosure_client.policy.list(query)
```

### Data

#### Get

Get values for a handler (with or without dependencies, please refer to Acrosure API Document).

```python
// Without dependencies
values = acrosure_client.data.get(
handler = '<some_handler>'
)

// With dependencies
values = acrosure_client.data.get(
handler = '<some_handler>',
dependencies = ['<dependency_1>', '<dependency_2>']
)
```

### Team

#### Get info

Get current team information.

```python
team_info = acrosure_client.team.get_info()
```

### Other functionality

#### Verify webhook signature

Verify webhook signature by specify signature and raw data string

```python
is_signature_valid = acrosure_client.verify_webhook(
signature = '<signature>',
data = '<raw_data>'
)
```

## Advanced Usage

Please refer to [this document](https://github.com/Acrosure/acrosure-python-sdk/wiki/Acrosure-Python-SDK) for AcrosureClient usage.

And refer to [Acrosure API Document](https://docs.acrosure.com/docs/api-overall.html) for more details on Acrosure API.

## Associated Acrosure API endpoints

### Application

```
/applications/get
/applications/list
/applications/create
/applications/update
/applications/get-packages
/applications/get-package
/applications/select-package
/applications/submit
/applications/confirm
/applications/get-hash
```

### Product

```
/products/get
/products/list
```

### Policy

```
/policies/get
/policies/list
```

### Data

```
/data/get
```

### Team

```
/teams/get-info
```


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

acrosure_sdk-0.9.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distributions

acrosure_sdk-0.9.2-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

acrosure_sdk-0.9.2-py2-none-any.whl (18.2 kB view details)

Uploaded Python 2

File details

Details for the file acrosure_sdk-0.9.2.tar.gz.

File metadata

  • Download URL: acrosure_sdk-0.9.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

File hashes

Hashes for acrosure_sdk-0.9.2.tar.gz
Algorithm Hash digest
SHA256 46d48bc118bd86345aec7ff6f49a9c001065f5651baac7011360dcc7453bebb9
MD5 225334af7d0e92b23b359eb49d6ce582
BLAKE2b-256 2bf295503ed52874233bf7adc698eded4e4e3133e80aa167848c94c2975447dc

See more details on using hashes here.

File details

Details for the file acrosure_sdk-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: acrosure_sdk-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

File hashes

Hashes for acrosure_sdk-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 623f37299a0c4fc57584ae1cf44f5702fd89f6e77062d6afd9cdb63e32d1e484
MD5 34bb2436954dadfb2f6500685a8d25d0
BLAKE2b-256 9731a05220c3ba9829590e3b559a8d5033d474fbe162cb45b8e0deb35a80e450

See more details on using hashes here.

File details

Details for the file acrosure_sdk-0.9.2-py2-none-any.whl.

File metadata

  • Download URL: acrosure_sdk-0.9.2-py2-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

File hashes

Hashes for acrosure_sdk-0.9.2-py2-none-any.whl
Algorithm Hash digest
SHA256 40ace174b62aedcae9cde7dd837980a3cddb683b847ef9f2501ab86809888d27
MD5 b7275737a9017c77280978dacd7ed2fc
BLAKE2b-256 f1f1bc972b7baf9e1a4d5b9b7f3878743840c990ed6958b1e549703a914150e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page