Skip to main content

OpenPanel SDK for Python

Project description

OpenPanel Python SDK

The OpenPanel Python SDK allows you to track user behavior in your Python applications. This guide provides instructions for installing and using the Python SDK in your project.

Installation

⚠️ This package is not yet published. So you cannot install it with pip

You can install the OpenPanel Python SDK using pip:

pip install openpanel

Usage

Initialization

First, import the SDK and initialize it with your client ID:

from openpanel import OpenPanel

op = OpenPanel(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")

Options

When initializing the SDK, you can provide several options:

  • client_id (required): Your OpenPanel client ID.
  • client_secret (optional): Your OpenPanel client secret.
  • api_url (optional): Custom API URL if you're not using the default OpenPanel API.
  • filter (optional): A function to filter events before sending.
  • disabled (optional): Set to True to disable event sending.

Tracking Events

To track an event:

op.track("button_clicked", {"button_id": "submit_form"})

Identifying Users

To identify a user:

op.identify("user123", {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "customAttribute": "value"
})

Setting Global Properties

To set properties that will be sent with every event:

op.set_global_properties({
    "app_version": "1.0.2",
    "environment": "production"
})

Creating Aliases

To create an alias for a user:

op.alias("user123", "john_doe")

Incrementing Properties

To increment a numeric property on a user profile:

op.increment("user123", "login_count", 1)

Decrementing Properties

To decrement a numeric property on a user profile:

op.decrement("user123", "credits", 5)

Clearing User Data

To clear the current user's data:

op.clear()

Advanced Usage

Custom Event Filtering

You can set up custom event filtering:

def my_filter(payload):
    # Your custom filtering logic here
    return True  # or False to filter out the event

op = OpenPanel(client_id="YOUR_CLIENT_ID", filter=my_filter)

Disabling Tracking

You can temporarily disable tracking:

op = OpenPanel(client_id="YOUR_CLIENT_ID", disabled=True)

Thread Safety

The OpenPanel SDK is designed to be thread-safe. You can call its methods from any thread without additional synchronization.

Support

For any issues or feature requests, please file an issue on our GitHub repository.

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

openpanel-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distributions

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

openpanel-0.0.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

openpanel-0.0.1-py2-none-any.whl (15.9 kB view details)

Uploaded Python 2

File details

Details for the file openpanel-0.0.1.tar.gz.

File metadata

  • Download URL: openpanel-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

File hashes

Hashes for openpanel-0.0.1.tar.gz
Algorithm Hash digest
SHA256 96a27848d670218c03a75528b95b8e3efbd4898665d57b3ee9c81c4b3c06f922
MD5 f07b320d207457fb57486a2afc1aaf0a
BLAKE2b-256 42d21ca167988225113a2162fcc528ef309715f348e1ee2bcaa8405222fea08c

See more details on using hashes here.

File details

Details for the file openpanel-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: openpanel-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for openpanel-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d5a31694d4307975bbf70bbb2fa9fae920df0fb4b8ff97fa7b78ee8fe667b2
MD5 57fedfe22b6d0ab62eea37d11db73bf8
BLAKE2b-256 f97344ad513438c56d3e9c8dbdbea647a2f79e8be03a80967eeaa873f29a0527

See more details on using hashes here.

File details

Details for the file openpanel-0.0.1-py2-none-any.whl.

File metadata

  • Download URL: openpanel-0.0.1-py2-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

File hashes

Hashes for openpanel-0.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 2e3a395c4576c5452101f0d0fd6862fb11fbedc5523726af1b75fa08536e5aa5
MD5 a8799edce7f4bc237340e7c65dfaaf21
BLAKE2b-256 ff7ab9afa6039cce7b24eb4b4d1ecb5464ccfadbc73010ae5fe754497f7699b6

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