Skip to main content

Official Python Middleware for Helm Analytics

Project description

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))

Features

  • Non-blocking: Uses background threads to send data without slowing down your app (unless Shield Mode is on).
  • Shield Mode: Synchronously queries Helm to block threats at the edge.
  • Bot Detection: Passes server context (IP, User-Agent) for deeper analysis.
  • 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"

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

helm_analytics-1.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

helm_analytics-1.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file helm_analytics-1.1.0.tar.gz.

File metadata

  • Download URL: helm_analytics-1.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for helm_analytics-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d85f30a17fbe10f763f78f955d4e6a909108039574a6124d21ce633a25dabb43
MD5 331ac49508b3cfa712679b2177b5c242
BLAKE2b-256 b31df24b11b39f87fd8ab9b8e1852b8ac8e4d923ead935b7256f195878c61b7a

See more details on using hashes here.

File details

Details for the file helm_analytics-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: helm_analytics-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for helm_analytics-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 681883e3597f0c7f723434b05e284e2899827d7631bf6873a510fd879e3fc83e
MD5 beb4a4d5cbb33237b165fc541ea1654c
BLAKE2b-256 f70dfa5df46413c57b33bbe85f3bfda0841074a3f67d6d654be5cd34fd37fcec

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