Skip to main content

Official Python SDK for EventPulse Analytics — track events from Django, FastAPI, or any Python app

Project description

eventpulse-python

Official Python SDK for EventPulse Analytics.

Install

pip install eventpulse-python

Quick Start

from eventpulse import EventPulseClient

client = EventPulseClient(api_key="ep_live_YOUR_KEY")

client.track("signup", {"plan": "pro"})
client.identify("user_123")
client.page("https://yourapp.com/pricing")

# flush & stop background thread on app exit
client.shutdown()

Or use as a context manager:

with EventPulseClient(api_key="ep_live_YOUR_KEY") as client:
    client.track("purchase", {"amount": 49.99})

Django

Add to settings.py:

MIDDLEWARE = [
    ...
    "eventpulse.django.EventPulseMiddleware",
]

EVENTPULSE_API_KEY = "ep_live_YOUR_KEY"
# optional:
EVENTPULSE_ENDPOINT = "https://eventpulse-analytics-backend.onrender.com"

Every request is auto-tracked as a page_view with url, path, method, status code, referrer, and user agent. Authenticated Django users are identified automatically.

FastAPI / Starlette

from fastapi import FastAPI
from eventpulse.fastapi import EventPulseMiddleware

app = FastAPI()
app.add_middleware(EventPulseMiddleware, api_key="ep_live_YOUR_KEY")

Manual tracking in Django/FastAPI views

from eventpulse import EventPulseClient

ep = EventPulseClient(api_key="ep_live_YOUR_KEY")

@app.post("/checkout")
async def checkout(item: Item, user_id: str):
    ep.identify(user_id)
    ep.track("checkout", {"item": item.name, "price": item.price})
    ...

Options

Parameter Default Description
api_key required Your ep_live_*API key
endpoint production URL Override for local dev
batch_interval 5.0 Seconds between auto-flushes
max_queue_size 1000 Max queued events before oldest is dropped
max_retries 3 Retry attempts on network failure (exponential back-off)
async_mode True Background thread flushing. Set Falsefor scripts/tests

Event format

Sent to POST /api/v1/ingest/events/batch as:

{
  "events": [
    {
      "event_name": "signup",
      "user_id": "user_123",
      "properties": { "plan": "pro" },
      "client_time": "2026-03-27T10:00:00+00:00"
    }
  ]
}

Header: X-API-Key: ep_live_YOUR_KEY

Zero dependencies

The core SDK uses Python stdlib only (urllib, threading, json). Framework integrations (django, starlette) require those packages as extras.

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

eventpulse_python-1.0.0.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.

eventpulse_python-1.0.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file eventpulse_python-1.0.0.tar.gz.

File metadata

  • Download URL: eventpulse_python-1.0.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for eventpulse_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a596c369168a2de9a8869e6cf5d44fac649d671c04e167ca9206d1976eaa562b
MD5 ae930c6ecbfa61275519b838aac14606
BLAKE2b-256 032f99d7f9238f08994adb763ccb48c8d0df8c13e76598ca61c87b242832d6b5

See more details on using hashes here.

File details

Details for the file eventpulse_python-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eventpulse_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bc97605ec12725cb65b3ac1dd9dfeac3fc483f07cb355064e6376e6705a2555
MD5 58fb6e6ab742cb0d50c328251d05031c
BLAKE2b-256 87d8ba90acb36b05533d6b2c852f027873b8a05c79a8948863b955284ead492b

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