Skip to main content

Python SDK for the SendKit email API

Project description

SendKit Python SDK

Official Python SDK for the SendKit email API.

Installation

pip install sendkit

Usage

Create a Client

from sendkit import SendKit

client = SendKit("sk_your_api_key")

Send an Email

result = client.emails.send(
    from_="you@example.com",
    to="recipient@example.com",
    subject="Hello from SendKit",
    html="<h1>Welcome!</h1>",
)

print(result["id"])

Send a MIME Email

result = client.emails.send_mime(
    envelope_from="you@example.com",
    envelope_to="recipient@example.com",
    raw_message=mime_string,
)

Error Handling

API errors raise SendKitError:

from sendkit import SendKit, SendKitError

client = SendKit("sk_your_api_key")

try:
    client.emails.send(...)
except SendKitError as e:
    print(e.name)        # e.g. "validation_error"
    print(e.message)     # e.g. "The to field is required."
    print(e.status_code) # e.g. 422

Configuration

# Read API key from SENDKIT_API_KEY environment variable
client = SendKit()

# Custom base URL
client = SendKit("sk_...", base_url="https://custom.api.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

sendkit-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

sendkit-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file sendkit-1.0.0.tar.gz.

File metadata

  • Download URL: sendkit-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sendkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 76d3c5493c79b1efbf4f44763abf70b8d6112082741f207f4a929f0d0489bb69
MD5 628323daea4ec269d5a38c61e7fdccb1
BLAKE2b-256 d7ad199fd0ed39acc56bfc9f02e91da4535f1d555a2d334315c26944296313f9

See more details on using hashes here.

File details

Details for the file sendkit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sendkit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sendkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99fac740131c6aab354189d2a26f61a129e8b666f8f8415dae49d77d4f2b6ba8
MD5 d69918df58c6d32ae6ee6605a31a6776
BLAKE2b-256 aa6e0646fff50200d78ea5e698328b0cda025c135f99641be82322957671e15a

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