py-vapid
Simple VAPID header generation library
What it is and what it does
py-vapid is a minimal library for generating VAPID credentials used in WebPush authentication. VAPID is a voluntary standard that allows application servers sending push notifications to self-identify to push service providers. The library generates public/private key pairs and signs VAPID claims (JSON structures containing subscriber email, audience URL, and expiration timestamp) into HTTP headers that push services can verify.
The package works with cryptography as its sole runtime dependency and can be used either as a library in Python code or as a command-line tool (bin/vapid) for key generation and header signing. It handles the required VAPID claim fields (sub, aud, exp) and optional fields, auto-generating expiration timestamps when not specified.
Use it for:
- Generate VAPID key pairs for a WebPush service during initial setup or key rotation
- Sign VAPID claims into HTTP headers before sending push subscription updates to a push service
- Create restricted subscription endpoints by extracting the applicationServerKey for client-side subscription
- Manage VAPID expiration timestamps to prevent replay attacks in push notification workflows
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates VAPID (Voluntary Application Server Identification) headers and key pairs for WebPush subscription authentication between application servers and push service providers.
Yes. This is a focused, actively maintained library with low install friction and no known vulnerabilities. Install it if you're building a WebPush notification system and need to authenticate with push service providers. The MPL-2.0 license requires source disclosure of modifications but poses no barrier to typical use.
Install
py-vapid on PyPI
pip
pip install py-vapiduv
uv add py-vapidpoetry
poetry add py-vapidInstalling py-vapid
Before you install
Low install friction with a single runtime dependency (cryptography). Actively maintained with a recent release and no known vulnerabilities.
License in practice
Licensed under MPL-2.0 (copyleft). You must disclose source code modifications and distribute under the same license if you modify and redistribute the package.
Quickstart
pip install py-vapid
from py_vapid import Vapid01
vapid = Vapid01()
vapid.generate_keys()
headers = vapid.sign({"sub": "mailto:admin@example.com", "aud": "https://push.example.com", "exp": "ExpirationTimestamp"})
Verify before relying
- Whether the library supports VAPID protocol versions beyond the initial implementation
- Performance characteristics when signing large batches of claims
- Compatibility with specific push service providers and their VAPID requirements
Package facts
| License | MPL-2.0 (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — cryptography |
| Maintenance | actively maintained — 221 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,216,733/month — #1,957 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py_vapid-1.9.4-py2.py3-none-any.whl
Keywords: push, vapid, webpush
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
pywebpushEncrypts and sends web push notifications to…
copyleft · top 5,000 on PyPI
django-push-notificationsA Django app that manages device registrations…
permissive · top 15,000 on PyPI
pypushdeerA Python SDK for sending push notifications…
permissive · top 15,000 on PyPI
py-builder-signing-sdkGenerates cryptographically signed HTTP headers…
permissive · top 15,000 on PyPI
auth0-api-pythonVerifies Auth0-issued access tokens and secures…
permissive · top 15,000 on PyPI
vonage-jwtGenerates and verifies JWTs for Vonage API…
permissive · top 15,000 on PyPI
aws-request-signerSigns HTTP requests using AWS Signature V4,…
permissive · top 15,000 on PyPI
django-allauthProvides integrated local and social…
permissive · top 5,000 on PyPI
apns2-upSends push notifications to iOS devices through…
permissive · top 15,000 on PyPI
joseImplements JSON Web Signature (JWS) and JSON…
permissive · top 15,000 on PyPI