Skip to main content

A simple web push notification tool

Project description

License: NCPUL

GenWebPush

A minimal, zero-backend helper for Web Push notifications.

GenWebPush spins up a one-file Flask server that:

  • serves a progressive-web-app (PWA) shell with friendly, per-browser setup tips
  • generates VAPID keys on the fly (or accepts your own)
  • stores each subscription in a plain JSON file
  • offers straightforward helpers for sending Web Push messages to one device or all of them using said JSON files

Features

What you get
Automatic VAPID key generation if none supplied
PWA assets (manifest, service-worker, offline page) for installable testing
Browser-specific instructions auto-expanded on load
helpers to send a notification to one file or an entire folder of devices
Clean JSON device files you can commit, inspect, or reuse elsewhere

Quick start

1. Install with pip

pip install genwebpush

2. Launch the local server

python -m genwebpush --mailto you@example.com
# optional if you want to use your own VAPID keys:
#   --public_key  VAPID_PUBLIC
#   --private_key VAPID_PRIVATE

The server listens on https://localhost:5000 using an ad-hoc cert so modern browsers allow push. Flask will also display your devices IP address if you want to set up notifications on a different device.

3. Subscribe a device

Open the URL in your browser/device, click through possible warnings due to adhoc generation of SSL cert, hit “Got it — Activate Notifications”, approve the permission prompt, and enter the device Name. A JSON file with the set Name appears in the working directory.

4. Send yourself a push

from pathlib import Path
from genwebpush.core import send_push_to_all_files

payload = {
    "title": "Hello, world!",
    "body":  "Your Safari push worked!!",
    # "navigate": "https://example.com"   # optional deep-link
}

send_push_to_all_files(Path("."), payload)

Configuration options

Flag / field Purpose
--mailto you@host.tld Required – used as sub claim in VAPID
--public_key Re-use an existing VAPID public key
--private_key Re-use an existing VAPID private key
device_name (JS) Friendly name written to <name>.json

If you omit the VAPID keys, GenWebPush creates a fresh pair everytime it runs and injects the public key into the served HTML.


Compatibility notes

  • Safari (macOS & iOS ≥ 17): Works out of the box thanks to the PWA install step.
  • Edge / Chrome / Firefox (desktop & mobile): Full support.

License

This project is distributed under the NCPU License – see LICENSE.md for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genwebpush-0.1.7.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genwebpush-0.1.7-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file genwebpush-0.1.7.tar.gz.

File metadata

  • Download URL: genwebpush-0.1.7.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.7

File hashes

Hashes for genwebpush-0.1.7.tar.gz
Algorithm Hash digest
SHA256 d2cc7ff62b610ba085b5f2c2e4510507e6e7e72613a27f842ff134b8fde9c9c6
MD5 1abffe3365348a97228c81cad469389c
BLAKE2b-256 e798a816ad7b49aa047b890384dfe7bce7d51a422d3e8611825b9f9ec49b1e2e

See more details on using hashes here.

File details

Details for the file genwebpush-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: genwebpush-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.7

File hashes

Hashes for genwebpush-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0d4c3255c7cc26cc574fe5a3af99ec9b45b4bcaad7657c613c4a1580c81874d4
MD5 23e45e50c099e4db5bfb202ff69b8bf9
BLAKE2b-256 4324e76486b64ca8a3f219b46a6fdc73827cf82f356d73a51c1d978ebe9340ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page