Web Push SDK for Herfy applications — send browser push notifications via Control Center VAPID config
Project description
herfy-push
Web Push SDK for Herfy applications. Send browser push notifications using only your Control Center client_id and client_secret — no VAPID private key handling in app config.
Installation
pip install herfy-push
Usage
from herfy_push import HerfyPushClient, AsyncHerfyPushClient
# Sync
client = HerfyPushClient.from_credentials(
client_id="app_customer_care",
client_secret="your_secret",
control_center_url="https://cc.herfy.com",
)
client.send(
subscription={"endpoint": "...", "keys": {"p256dh": "...", "auth": "..."}},
payload={"title": "SLA breach", "body": "Ticket #123", "url": "https://app/tickets/123"},
)
# Async (FastAPI)
client = AsyncHerfyPushClient.from_env()
await client.send(subscription=..., payload=...)
public_key = await client.get_public_key() # hand to the browser's pushManager.subscribe()
How it works
- SDK authenticates with Control Center via
POST /oauth/token(cached, TTL configurable viaPUSH_TOKEN_CACHE_TTL). - SDK fetches VAPID keys from
GET /api/config/push(cached for the client's process lifetime). - SDK sends directly to the browser's push service via the Web Push protocol (
pywebpush) — no further Control Center round-trip per send.
Error handling
AuthError— Control Center rejected the client credentials.ConfigError— Control Center push config endpoint failed or is missing VAPID keys.PushSubscriptionExpiredError— the push service returned 404/410: the subscription is dead, delete it from your database.SendError— any other send failure.
Environment variables
CONTROL_CENTER_URL,AUTH_CLIENT_ID,AUTH_CLIENT_SECRET— required, used by.from_env().PUSH_TOKEN_CACHE_TTL(default240),PUSH_REQUEST_TIMEOUT(default15) — optional.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file herfy_push-1.0.0.tar.gz.
File metadata
- Download URL: herfy_push-1.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
283095aee5373219e13b9ef21af62a83f77b5d9d1280b80d573bc84bc20d5397
|
|
| MD5 |
8cf276ef15416b3d07eedd8de331451f
|
|
| BLAKE2b-256 |
17d1d14a04f5f3e9f1d296727d65c309f3f15476bf56105b8ee1670a8feed609
|
Provenance
The following attestation bundles were made for herfy_push-1.0.0.tar.gz:
Publisher:
publish-push-sdk.yml on Herfy-Food-Services/herfy-shared-library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
herfy_push-1.0.0.tar.gz -
Subject digest:
283095aee5373219e13b9ef21af62a83f77b5d9d1280b80d573bc84bc20d5397 - Sigstore transparency entry: 1951202362
- Sigstore integration time:
-
Permalink:
Herfy-Food-Services/herfy-shared-library@74994107621b6f75bc3447e9582e674a4f5b64c5 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Herfy-Food-Services
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-push-sdk.yml@74994107621b6f75bc3447e9582e674a4f5b64c5 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file herfy_push-1.0.0-py3-none-any.whl.
File metadata
- Download URL: herfy_push-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87436fa95fb853d0e86dec868370b59516f7bc1135835f584bfc4c1427f9643f
|
|
| MD5 |
5bb1e63d5c106590c2b193c04f4c6691
|
|
| BLAKE2b-256 |
a733b1936750322a76b7ac09138156f58f197b6ccb8c413c58f5b1a385632211
|
Provenance
The following attestation bundles were made for herfy_push-1.0.0-py3-none-any.whl:
Publisher:
publish-push-sdk.yml on Herfy-Food-Services/herfy-shared-library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
herfy_push-1.0.0-py3-none-any.whl -
Subject digest:
87436fa95fb853d0e86dec868370b59516f7bc1135835f584bfc4c1427f9643f - Sigstore transparency entry: 1951202513
- Sigstore integration time:
-
Permalink:
Herfy-Food-Services/herfy-shared-library@74994107621b6f75bc3447e9582e674a4f5b64c5 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/Herfy-Food-Services
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-push-sdk.yml@74994107621b6f75bc3447e9582e674a4f5b64c5 -
Trigger Event:
workflow_dispatch
-
Statement type: