Skip to content

The Python SDK

Install the Python SDK to run the widget from a Django or Flask app.

No runtime dependencies.

Django:

INSTALLED_APPS = [
# ...
"vroxy.django",
]
MIDDLEWARE = [
# ... after AuthenticationMiddleware, so request.user is resolved
"vroxy.django.middleware.VroxyMiddleware",
]

Django identity resolution reads request.user: external_id from str(user.pk), email from user.email, name from get_full_name(), and role of "admin" when the user is is_staff or is_superuser. Anonymous requests get the loader tag only.

Flask:

from flask import Flask
from vroxy.flask import Vroxy
app = Flask(__name__)
Vroxy(app)

Flask has no universal current-user convention, so identify stays anonymous until you set a resolver.

FastAPI is not supported. FastAPI apps are API-first and rarely serve HTML; embed the snippet by hand on any HTML you do serve.

Custom resolver:

import vroxy
def identify(request):
user = getattr(request, "user", None)
if user is None or not user.is_authenticated:
return None
return {
"external_id": str(user.pk),
"email": user.email,
"name": user.get_full_name(),
"role": "admin" if user.is_staff else "basic",
}
vroxy.configure(identify=identify)

Configuration: api_key, endpoint, enabled, auto_inject, identify, exclude_paths (exact strings or compiled regexes), csp_nonce, identity_secret, admin_roles (default ["admin", "owner"]), report_errors, error_ignore.

Manual placement: {% vroxy_snippet %} in a Django template (requires the request context processor) or {{ vroxy_snippet() }} in Jinja.