← Winnitude! Search  ·  Reader Mode (1047 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 37 LINKS

GitHub - Openpanel-dev/python-sdk

Repository navigation

python-sdk
Public

About

No description, website, or topics provided.

Resources

Readme AGPL-3.0 license Activity Custom properties

Stars

1 star

Watchers

0 watching

Forks

1 fork Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


9 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
openpanel openpanel    
tests tests    
.gitignore .gitignore    
LICENSE.md LICENSE.md    
README.md README.md    
publish.sh publish.sh    
setup.py setup.py    

Repository files navigation

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

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 .

About

No description, website, or topics provided.

Resources

Readme AGPL-3.0 license Activity Custom properties

Stars

1 star

Watchers

0 watching

Forks

1 fork Report repository

Releases

Packages

Used by

Contributors

Languages