skillfed

pywebpush

WebPush publication library

pywebpush v2.4.0 5.8M downloads/30d#2,035 on PyPI375
Copyleft license MPL-2.0 Active released

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 pywebpush

uv

uv add pywebpush

poetry

poetry add pywebpush

Installing 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

Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP

Tags

web push notificationsbrowser push encryptionvapid authenticationweb push protocolpush notification backendencrypted push messageswebpush library
push-notificationsweb-standardscryptography

More WWW/HTTP packages