pywebpush
WebPush publication library
What it is and what it does
Pywebpush is a Python library for sending encrypted web push notifications to browsers via the Web Push Protocol. It handles the cryptographic encryption (aes128gcm or aesgcm), VAPID authentication headers, and HTTP delivery to push service endpoints. The library accepts browser PushSubscription objects (converted to JSON), encrypts your message payload, and sends it to the appropriate push service.
You can use it either as a one-call function for simple sends or instantiate a WebPusher object for repeated sends to the same recipient. It depends on aiohttp, cryptography, http-ece, requests, and py-vapid to handle encryption, HTTP transport, and VAPID key management. The library includes a command-line tool for testing and supports platform-specific headers (notably for Windows notifications).
Use it for:
- Send encrypted notifications from a web backend to subscribed browser clients without exposing message content to the push service.
- Implement a notification system for a web app where users grant push permission and you store their subscription info server-side.
- Batch-send the same message to many users by iterating over stored subscriptions and calling webpush() for each.
- Test push notification integration during development using the command-line tool with subscription and message files.
- Handle platform-specific push requirements (e.g., Windows) by passing custom headers to the send() method.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Encrypts and sends web push notifications to browser push services using the Web Push Protocol, handling VAPID authentication and RFC 8188 encryption standards.
Yes, if you need to send web push notifications from a Python backend. The library is actively maintained, has no known vulnerabilities, and handles the complex encryption and VAPID protocol correctly. Install friction is low. The MPL-2.0 copyleft license is standard for server-side use but requires disclosure of modifications. Single-person maintenance is a long-term risk; evaluate your tolerance for potential delays in bug fixes or updates.
Install
pywebpush on PyPI
pip
pip install pywebpushuv
uv add pywebpushpoetry
poetry add pywebpushInstalling pywebpush
Before you install
Low install friction with a pure-Python wheel. Maintained actively as of August 2026, though the maintainer notes single-person stewardship. No known vulnerabilities.
License in practice
Licensed under MPL-2.0 (copyleft). You must disclose source modifications and license derivative works under the same terms; suitable for server-side use but review required if bundling or redistributing.
Quickstart
from pywebpush import webpush
webpush(
subscription_info={"endpoint": "https://push.example.com/v1/12345",
"keys": {"p256dh": "...", "auth": "..."}},
data="Your message",
vapid_private_key="path/to/private.pem",
vapid_claims={"sub": "mailto:you@example.org"}
)
Requires Python >= 3.10 and a VAPID EC2 private key (generated via openssl ecparam or py-vapid).
Verify before relying
- Whether the library handles connection pooling or rate-limiting for bulk sends to many recipients.
- Performance characteristics when sending to thousands of subscriptions in a single session.
- Support status for alternative push services beyond Mozilla and Google Cloud Messaging.
Package facts
| License | MPL-2.0 (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — aiohttp, cryptography, http-ece, requests, py-vapid |
| Maintenance | actively maintained — 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,794,972/month — #2,035 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pywebpush-2.4.0-py3-none-any.whl
Keywords: webpush, vapid, notification
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
py-vapidGenerates VAPID (Voluntary Application Server…
copyleft · top 5,000 on PyPI
django-push-notificationsA Django app that manages device registrations…
permissive · top 15,000 on PyPI
http-eceImplements encrypted content encoding for HTTP…
permissive · top 5,000 on PyPI
pyfcmPyFCM is a Python client for Firebase Cloud…
permissive · top 15,000 on PyPI
fcm-djangoDjango app that integrates Firebase Cloud…
permissive · top 15,000 on PyPI
aioapnsaioapns sends push notifications to iOS devices…
permissive · top 5,000 on PyPI
pushbullet.pyA Python client library for the Pushbullet API…
permissive · top 15,000 on PyPI
firebase-messagingReceives push notifications sent via Firebase…
permissive · top 15,000 on PyPI
pyapns-clientSends Apple Push Notifications to iOS, macOS,…
permissive · top 5,000 on PyPI
apns2-upSends push notifications to iOS devices through…
permissive · top 15,000 on PyPI