Async CustomerIO Client - a Python client to interact with CustomerIO in an async fashion.
Project description
async-customerio is a lightweight asynchronous client to interact with CustomerIO
- Free software: MIT license
- Requires: Python 3.7+
Features
- Fully async
- Interface preserved as Official Python Client
customerio
has - Send push notification
- Send messages
Installation
pip install async-customerio
Getting started
import asyncio
from async_customerio import AsyncCustomerIO, Regions
async def main():
site_id = "Some-id-gotten-from-CustomerIO"
api_key = "Some-key-gotten-from-CustomerIO"
cio = AsyncCustomerIO(site_id, api_key, region=Regions.US)
await cio.identify(
id=5,
email="customer@example.com",
first_name="John",
last_name="Doh",
subscription_plan="premium",
)
await cio.track(
customer_id=5, name="product.purchased", product_sku="XYZ-12345", price=23.45
)
if __name__ == "__main__":
asyncio.run(main())
Instantiating AsyncCustomerIO
object
Create an instance of the client with your Customer.io credentials.
from async_customerio import AsyncCustomerIO, Regions
cio = AsyncCustomerIO(site_id, api_key, region=Regions.US)
region
is optional and takes one of two values — Regions.US
or Regions.EU
. If you do not specify your region, we assume
that your account is based in the US (Regions.US
). If your account is based in the EU and you do not provide the correct region
(Regions.EU
), we'll route requests to our EU data centers accordingly, however, this may cause data to be logged in the US.
Securely verify requests doc
from async_customerio import validate_signature
def main():
webhook_signing_key = (
"755781b5e03a973f3405a85474d5a032a60fd56fabaad66039b12eadd83955fa"
)
x_cio_timestamp = 1692633432 # header value
x_cio_signature = "d7c655389bb364d3e8bdbb6ec18a7f1b6cf91f39bba647554ada78aa61de37b9" # header value
body = b'{"key": "value"}'
if validate_signature(
signing_key=webhook_signing_key,
timestamp=x_cio_timestamp,
request_body=body,
signature=x_cio_signature,
):
print("Request is sent from CustomerIO")
else:
print("Malicious request received")
if __name__ == "__main__":
main()
License
async-customerio
is offered under the MIT license.
Source code
The latest developer version is available in a GitHub repository: https://github.com/healthjoy/async-customerio
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 async_customerio-1.4.1.tar.gz
.
File metadata
- Download URL: async_customerio-1.4.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.5.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 604a0f4dd63ef0bc43bec17e831559c0b7ca0e8a27f8f3477d1365aed290d9b3 |
|
MD5 | 9cd950c4faefdf89579c490380ed3f54 |
|
BLAKE2b-256 | 45805ee9dc2cb43902974b58a3b9a14d9a504d8cc5520405f1a768f06816865c |
File details
Details for the file async_customerio-1.4.1-py3-none-any.whl
.
File metadata
- Download URL: async_customerio-1.4.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.5.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13b65f0ab69b4bc9beefc61ce8865092056278edeca076d985069e7c1988fdd1 |
|
MD5 | 1c9f7d4975ab07170b113713b4e8ac3e |
|
BLAKE2b-256 | 7447906eaab61091b9370f2ff3799b0b251631a68a91457f276f618340596281 |