Skip to main content

A python package that wraps ChurnZero's HTTP API for easier usage of their HTTP API.

Project description

ChurnZero Python API Wrapper

This is a Python API wrapper for the ChurnZero HTTP API. It provides a convenient way to interact with the ChurnZero HTTP API platform. The following features are supported:

  • Set Account Attributes (multi attributes only)
  • Set Contact Attributes (multi attributes only)
  • Track Events

Other features may be supported in the future.

The wrapper only supports the HTTP API integrations documented on this page: ChurnZero HTTP API. REST features may be supported in the future.

Note: This is an unofficial API wrapper and is not affiliated with ChurnZero.

Installation

To install the ChurnZero Python API Wrapper, you can use pip:

pip install churnzero_api_wrapper

Usage

To use the ChurnZero Python API Wrapper, you need to import the HTTPClient class from the package:

from churnzero_api_wrapper import HTTPClient

Next, you need to create an instance of the HTTPClient class and provide your ChurnZero APP credentials:

client = HTTPClient(app_key='{app_key}', host = "https://{domain}.churnzero.net/i")

Your app key and domain can be found in the ChurnZero dashboard under Admin -> Data -> Application Keys -> Application Key & HTTP API Endpoint.

Once you have created the client, you can start making HTTP API requests. For example, to set an Account attribute:

account = {
    "externalAccountID": "12345",
    "attr{CustomAttribute1}": "Value1",
}
client.set_account_attributes(account)

To set a Contact attribute:

contact = {
    "externalAccountID": "12345",
    "externalContactID": "67890",
    "attrFirstName": "Value1",
    "attrLastName": "Value2",
}

client.set_contact_attributes(contact)

To track an event:

event = {
    "externalAccountID": "12345",
    "externalContactID": "67890",
    "eventName": "EventName",
    "description": "EventDescription",
    "eventDate": "2021-01-01T00:00:00Z",
}

client.track_event(event)

Logging

To configure the logging level for the ChurnZero Python API Wrapper, you can use the logging module in Python. Here's an example of how to set the log level to DEBUG:

import logging

# Set the log level to DEBUG
logging.getLogger().setLevel(logging.DEBUG)
# Set the log level to INFO
logging.getLogger().setLevel(logging.INFO)
# Set the log level to WARNING
logging.getLogger().setLevel(logging.WARNING)
# Set the log level to ERROR
logging.getLogger().setLevel(logging.ERROR)

WARNING: note that setting the log level to DEBUG will expose the app_key to logs due to ChurnZero's HTTP API configuration. It is recommended to only use the DEBUG log level for debugging purposes and not in production environments.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

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

churnzero_api_wrapper-0.2.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

churnzero_api_wrapper-0.2.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file churnzero_api_wrapper-0.2.3.tar.gz.

File metadata

  • Download URL: churnzero_api_wrapper-0.2.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.9 Darwin/23.3.0

File hashes

Hashes for churnzero_api_wrapper-0.2.3.tar.gz
Algorithm Hash digest
SHA256 89066fd2db56ee7ac5bcad2d588bdf518600c83ae66d1628b927ddeb6367c736
MD5 fe0d8a12a69365c8ab5c904cffd4a690
BLAKE2b-256 88a338e4641567c7f6df7b49670e230f6b0b77881beffeba32e40be459212a57

See more details on using hashes here.

File details

Details for the file churnzero_api_wrapper-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for churnzero_api_wrapper-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a7168cc6c170133281646b33232713c23dfb58bb3f00f607398f269c8724b7e9
MD5 87b85905e9c6dc53e8a54b209f5f9ea9
BLAKE2b-256 2057734aebf68206889d99fb42da1687753c0564d8e8eba650589cb3189bf871

See more details on using hashes here.

Supported by

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