Python version 2 and 3 SDK for connecting with Acrosure Insurance Gateway
Install via pip:
pip install acrosure_sdk
- Python 2.7.1+
requests
library
Import AcrosureClient into your project.
from acrosure_sdk import AcrosureClient
Instantiate with an API key from Acrosure Dashboard.
acrosure_client = AcrosureClient(token = '<your_api_key>')
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:
{
"data": { ... },
"status": "ok",
...
}
Get application with specified id.
application = acrosure_client.application.get('<application_id>')
Create an application.
created_application = acrosure_client.application.create(
productId = '<product_id>', # required
basic_data = {},
package_options = {},
additional_data = {},
package_code = '<package_code>',
attachments = []
)
Update an application.
updatedApplication = acrosure_client.application.update(
application_id = '<application_id>', # required
basic_data = {},
package_options = {},
additional_data = {},
package_code = '<package_code>',
attachments = []
)
Get current application available packages.
packages = acrosure_client.application.get_packages(
'<application_id>'
)
Select package for current application.
updated_application = acrosure_client.application.select_package(
application_id = '<application_id>',
package_code = '<package_code>'
)
Get selected package of current application.
current_package = acrosure_client.application.get_package(
'<application_id>'
)
Get 2C2P hash.
returned_hash = acrosure_client.application.get_2c2p_hash(
application_id = '<application_id>',
args = '<arguments>'
)
Submit current application.
submitted_application = acrosure_client.application.submit(
'<application_id>'
)
Confirm current application.
This function needs secret API key.
confirmed_application = acrosure_client.application.confirm(
'<application_id>'
)
List your applications (with or without query).
applications = acrosure_client.application.list(query)
Get product with specified id.
product = acrosure_client.product.get('<product_id>')
List your products (with or without query).
products = acrosure_client.product.list(query)
Get policy with specified id.
policy = acrosure_client.policy.get('<policy_id>')
List your policies (with or without query).
policies = acrosure_client.policy.list(query)
Get values for a handler (with or without dependencies, please refer to Acrosure API Document).
// 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>']
)
Get current team information.
team_info = acrosure_client.team.get_info()
Verify webhook signature by specify signature and raw data string
is_signature_valid = acrosure_client.verify_webhook(
signature = '<signature>',
data = '<raw_data>'
)
Please refer to this document for AcrosureClient usage.
And refer to Acrosure API Document for more details on Acrosure API.
/applications/get
/applications/list
/applications/create
/applications/update
/applications/get-packages
/applications/get-package
/applications/select-package
/applications/submit
/applications/confirm
/applications/get-hash
/products/get
/products/list
/policies/get
/policies/list
/data/get
/teams/get-info