Provider-abstracted email SDK for Herfy applications — send via Control Center credentials
Project description
herfy-email
Provider-abstracted email SDK for Herfy applications. Send transactional email using only your Control Center client_id and client_secret — no email provider credentials in app config.
Installation
pip install herfy-email[mailgun]
Usage
from herfy_email import HerfyEmailClient, AsyncHerfyEmailClient
# Sync
client = HerfyEmailClient.from_credentials(
client_id="app_pettycash",
client_secret="your_secret",
control_center_url="https://cc.herfy.com",
)
client.send(to="user@herfy.com", subject="Hello", html="<p>Hello</p>", text="Hello")
# Async (FastAPI)
client = AsyncHerfyEmailClient.from_credentials(
client_id="app_pettycash",
client_secret="your_secret",
control_center_url="https://cc.herfy.com",
)
await client.send(to="user@herfy.com", subject="Hello", html="<p>Hello</p>", text="Hello")
# From environment variables (CC_CLIENT_ID / AUTH_CLIENT_ID, CC_CLIENT_SECRET / AUTH_CLIENT_SECRET, CC_URL / CONTROL_CENTER_URL)
client = HerfyEmailClient.from_env()
How it works
- SDK authenticates with Control Center via
POST /api/app-auth/token(cached, TTL 300s) - SDK fetches provider config from
GET /api/config/email(cached for process lifetime) - SDK calls the configured provider (Mailgun, SendGrid, …) directly
Switching email providers requires only a Control Center env-var change — zero app changes.
Provider support
| Provider | Extra |
|---|---|
| Mailgun | pip install herfy-email[mailgun] |
| SendGrid | pip install herfy-email[sendgrid] |
Control Center configuration
EMAIL_PROVIDER=mailgun
MAILGUN_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxx
MAILGUN_DOMAIN=mg.herfy.com
MAILGUN_FROM_ADDRESS=noreply@herfy.com
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
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_email-0.1.0.tar.gz.
File metadata
- Download URL: herfy_email-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aa6e654753727bbf46c17086dcab97a64a1c14c7de186e10bfd591074f4fb8c
|
|
| MD5 |
9c3b2dafe5bde6d94b8ffcd659d1a6b7
|
|
| BLAKE2b-256 |
a3a368e424adea1a8642d1bc4ad42bc7aa44d27492462015cdd898f6a176a7f2
|
Provenance
The following attestation bundles were made for herfy_email-0.1.0.tar.gz:
Publisher:
publish-email-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_email-0.1.0.tar.gz -
Subject digest:
3aa6e654753727bbf46c17086dcab97a64a1c14c7de186e10bfd591074f4fb8c - Sigstore transparency entry: 1792028164
- Sigstore integration time:
-
Permalink:
Herfy-Food-Services/herfy-shared-library@bc39afcd8e3e86b5a06296dc9053f1eea66e6ea0 -
Branch / Tag:
refs/tags/herfy-email/v0.1.0 - Owner: https://github.com/Herfy-Food-Services
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-email-sdk.yml@bc39afcd8e3e86b5a06296dc9053f1eea66e6ea0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file herfy_email-0.1.0-py3-none-any.whl.
File metadata
- Download URL: herfy_email-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 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 |
c6cb2958c8e6b4de3291670c80fe91a2db9a74098ffb7a270905fa16956ef0fd
|
|
| MD5 |
4a89d865781264ef94c14d55eca11145
|
|
| BLAKE2b-256 |
08aca9e02713d43c0d7154071364b222e5108afcd651f2f921886a86e87a0368
|
Provenance
The following attestation bundles were made for herfy_email-0.1.0-py3-none-any.whl:
Publisher:
publish-email-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_email-0.1.0-py3-none-any.whl -
Subject digest:
c6cb2958c8e6b4de3291670c80fe91a2db9a74098ffb7a270905fa16956ef0fd - Sigstore transparency entry: 1792028231
- Sigstore integration time:
-
Permalink:
Herfy-Food-Services/herfy-shared-library@bc39afcd8e3e86b5a06296dc9053f1eea66e6ea0 -
Branch / Tag:
refs/tags/herfy-email/v0.1.0 - Owner: https://github.com/Herfy-Food-Services
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-email-sdk.yml@bc39afcd8e3e86b5a06296dc9053f1eea66e6ea0 -
Trigger Event:
push
-
Statement type: