Official SendCraft SDK for Python - Send transactional emails and campaigns via the SendCraft API
Project description
SendCraft Python SDK
Official Python SDK for SendCraft — send transactional emails and campaigns via the SendCraft API.
Installation
pip install sendcraft-sdk
Quick Start
import os
from sendcraft import SendCraft
client = SendCraft(api_key=os.environ["SENDCRAFT_API_KEY"])
result = client.send_email(
to_email="user@example.com",
subject="Hello from SendCraft",
html_content="<h1>Hello!</h1><p>Welcome!</p>",
from_email="noreply@yourdomain.com"
)
print(result)
Environment Variables
SENDCRAFT_API_KEY=sk_live_your_key_here
Usage Examples
Send Bulk Emails
client.send_bulk_emails(
emails=[
{"toEmail": "user1@example.com", "toName": "John"},
{"toEmail": "user2@example.com", "toName": "Jane"},
],
subject="Weekly Newsletter",
html_content="<h1>This week...</h1>",
from_email="newsletter@yourdomain.com"
)
Create Campaign
client.create_campaign(
name="Product Launch",
subject="Big News!",
html_content="<h1>Check it out!</h1>",
from_email="marketing@yourdomain.com",
recipients=["user1@example.com", "user2@example.com"]
)
Error Handling
from sendcraft import SendCraft, SendCraftError, UnauthorizedError, RateLimitError
try:
client.send_email(...)
except UnauthorizedError:
print("Invalid API key")
except RateLimitError:
print("Too many requests")
except SendCraftError as e:
print("Error:", e)
API Reference
| Method | Description |
|---|---|
send_email(...) |
Send a single email |
send_bulk_emails(...) |
Send to multiple recipients |
schedule_email(...) |
Schedule email for later |
get_email_stats() |
Get email statistics |
create_campaign(...) |
Create campaign |
get_campaigns(limit) |
List campaigns |
send_campaign(id) |
Send campaign |
create_template(...) |
Create template |
get_templates() |
List templates |
create_webhook(...) |
Create webhook |
get_analytics(id) |
Campaign analytics |
get_account() |
Account info |
Support
- Website: https://sendcraft.online
- Email: sendcraft.team@gmail.com
License
MIT
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
sendcraft_sdk-1.1.0.tar.gz
(4.8 kB
view details)
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 sendcraft_sdk-1.1.0.tar.gz.
File metadata
- Download URL: sendcraft_sdk-1.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05769abf0d1fd8599bcfcf8f7c9ba5f00f3c6481e6fe9ac3b86e46a7324f867f
|
|
| MD5 |
4209a04849ed2f0611b77a4ef443fb81
|
|
| BLAKE2b-256 |
589c6c434a2ce41cf8597b6f81aed17441c0db5b75676caf0874743a99657a5b
|
File details
Details for the file sendcraft_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: sendcraft_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c803d83e8ea3219256ac2fd333f08d12bdfca8439a975ea467d182a7b42f1d5c
|
|
| MD5 |
ba8fdf65021478e8b4aa6c7978e5cab4
|
|
| BLAKE2b-256 |
5c57240cc2683da826483fc327e1122fd759ce88248bf7484d6ed9f08382f4f3
|