-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support of Python 3.12 (#17)
* feat: Add support of Python 3.12 Add typing_extensions
- Loading branch information
Showing
10 changed files
with
514 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo | |
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
- Using welcoming and inclusive language | ||
- Being respectful of differing viewpoints and experiences | ||
- Gracefully accepting constructive criticism | ||
- Focusing on what is best for the community | ||
- Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
- The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
- Trolling, insulting/derogatory comments, and personal or political attacks | ||
- Public or private harassment | ||
- Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
- Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
|
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe | |
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <[email protected]>. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
# async-customerio is a lightweight asynchronous client to interact with CustomerIO | ||
|
||
[![PyPI download month](https://img.shields.io/pypi/dm/async-customerio.svg)](https://pypi.python.org/pypi/async-customerio/) | ||
[![PyPI version fury.io](https://badge.fury.io/py/async-customerio.svg)](https://pypi.python.org/pypi/async-customerio/) | ||
[![PyPI license](https://img.shields.io/pypi/l/async-customerio.svg)](https://pypi.python.org/pypi/async-customerio/) | ||
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/async-customerio.svg)](https://pypi.python.org/pypi/async-customerio/) | ||
[![CI](https://github.com/healthjoy/async-customerio/actions/workflows/ci.yml/badge.svg)](https://github.com/healthjoy/async-customerio/actions/workflows/ci.yml) | ||
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/3629b50827ef4e89ba0eaa5c09584273)](https://www.codacy.com/gh/healthjoy/async-customerio/dashboard?utm_source=github.com&utm_medium=referral&utm_content=healthjoy/async-customerio&utm_campaign=Badge_Coverage) | ||
|
||
* Free software: MIT license | ||
* Requires: Python 3.7+ | ||
- Free software: MIT license | ||
- Requires: Python 3.7+ | ||
|
||
## Features | ||
|
||
* Fully async | ||
* Interface preserved as Official Python Client `customerio` has | ||
* Send push notification | ||
* Send messages | ||
- Fully async | ||
- Interface preserved as Official Python Client `customerio` has | ||
- Send push notification | ||
- Send messages | ||
|
||
## Installation | ||
|
||
```shell script | ||
$ pip install async-customerio | ||
pip install async-customerio | ||
``` | ||
|
||
## Getting started | ||
|
||
```python | ||
import asyncio | ||
|
||
|
@@ -32,20 +35,27 @@ 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="[email protected]", 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) | ||
await cio.identify( | ||
id=5, | ||
email="[email protected]", | ||
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 | ||
### Instantiating `AsyncCustomerIO` object | ||
|
||
Create an instance of the client with your [Customer.io credentials](https://fly.customer.io/settings/api_credentials). | ||
|
||
```python | ||
|
||
from async_customerio import AsyncCustomerIO, Regions | ||
|
||
|
||
|
@@ -57,25 +67,27 @@ that your account is based in the US (`Regions.US`). If your account is based in | |
(`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](https://customer.io/docs/journeys/webhooks/#securely-verify-requests) | ||
|
||
```python | ||
from async_customerio import validate_signature | ||
|
||
|
||
def main(): | ||
webhook_signing_key = "755781b5e03a973f3405a85474d5a032a60fd56fabaad66039b12eadd83955fa" | ||
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 | ||
signing_key=webhook_signing_key, | ||
timestamp=x_cio_timestamp, | ||
request_body=body, | ||
signature=x_cio_signature, | ||
): | ||
print('Request is sent from CustomerIO') | ||
print("Request is sent from CustomerIO") | ||
else: | ||
print('Malicious request received') | ||
print("Malicious request received") | ||
|
||
|
||
if __name__ == "__main__": | ||
|
@@ -84,7 +96,7 @@ if __name__ == "__main__": | |
|
||
## License | ||
|
||
``async-customerio`` is offered under the MIT license. | ||
`async-customerio` is offered under the MIT license. | ||
|
||
## Source code | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,12 @@ | |
|
||
As of December 7, 2022: | ||
|
||
| Version | Supported | | ||
| ------- | ------------------ | | ||
| < 1.0 | :white_check_mark: Current Stable, Actively developing | | ||
| Version | Supported | | ||
| ------- | ------------------------------------------------------ | | ||
| \< 1.0 | :white_check_mark: Current Stable, Actively developing | | ||
|
||
## Reporting a Vulnerability | ||
|
||
Please report (suspected) security vulnerabilities to [email protected]. | ||
Please report (suspected) security vulnerabilities to <[email protected]>. | ||
You will receive a response from us within 48 hours. If the issue is confirmed, | ||
we will release a patch as soon as possible depending on complexity. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.