Skip to main content

Helm Analytics Python SDK

Official Python middleware for Helm Analytics. Track server-side events, verify traffic quality, and bypass ad-blockers by ingesting data directly from your backend.

Installation

pip install helm-analytics

Quick Start (FastAPI)

from fastapi import FastAPI
from starlette.middleware.base import BaseHTTPMiddleware
from helm_analytics import HelmAnalytics

app = FastAPI()

# Initialize Helm
helm = HelmAnalytics(site_id="YOUR_SITE_ID_HERE")

# Register Middleware
app.add_middleware(BaseHTTPMiddleware, dispatch=helm.fastapi_dispatch)

@app.get("/")
def home():
    return {"message": "Hello World"}

Shield Mode (Blocking)

Helm can actively block malicious requests (e.g. from banned IPs or countries) before they hit your logic.

# Flask
app.before_request(helm.flask_middleware(shield=True))

# FastAPI
app.add_middleware(BaseHTTPMiddleware, dispatch=helm.fastapi_middleware(shield=True))

Custom Event Tracking

Track meaningful milestones like signups, payments, or file exports:

@app.post("/signup")
def signup(request):
    # ... logic ...
    helm.track_event(request, "user_signup", {"plan": "premium"})
    return {"status": "ok"}

Session Stitching

To link server-side events back to the browser session, pass the sessionId from your frontend (stored in sessionStorage as helm_session_id) in the X-Helm-Session-Id header of your API requests.

Features

  • Non-blocking: Uses background threads to send data without slowing down your app.
  • Shield Mode: Synchronously queries Helm to block threats at the edge.
  • Custom Events: Track business milestones beyond simple pageviews.
  • Session Stitching: Link server-side actions to web sessions via headers.
  • Fail-safe: Failures in tracking do not crash your application.

Configuration

You can also set the Site ID via environment variable:

export HELM_SITE_ID="your-uuid"

Metadata

Release files for helm-analytics 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for helm-analytics 5.0.0
File Size Uploaded
helm_analytics-5.0.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for helm-analytics 5.0.0
File Interpreter ABI Platform
helm_analytics-5.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / helm_analytics-5.0.0.tar.gz

Download URL helm_analytics-5.0.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6d0ef4c42e34a08181a1b3520767bf42ba4c9992dc83606e8d30ff0a7cc42af5
BLAKE2b-256 checksum
How to use checksums
62e2b2b8d27ca4acfb2dbd61f87d17c825d35a39945f30d45d98297d278e072c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / helm_analytics-5.0.0-py3-none-any.whl

Download URL helm_analytics-5.0.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12e669f171389b4a6e3950466ad3effcff766bd8b3987539af5ee4cff901ea87
BLAKE2b-256 checksum
How to use checksums
5a97e2a1d7301b01a8dabdc872d12404fe389a936dbd68d07b273476256ae2a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

5.0.0 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page