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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d85f30a17fbe10f763f78f955d4e6a909108039574a6124d21ce633a25dabb43
|
|
| MD5 |
331ac49508b3cfa712679b2177b5c242
|
|
| BLAKE2b-256 |
b31df24b11b39f87fd8ab9b8e1852b8ac8e4d923ead935b7256f195878c61b7a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
681883e3597f0c7f723434b05e284e2899827d7631bf6873a510fd879e3fc83e
|
|
| MD5 |
beb4a4d5cbb33237b165fc541ea1654c
|
|
| BLAKE2b-256 |
f70dfa5df46413c57b33bbe85f3bfda0841074a3f67d6d654be5cd34fd37fcec
|