Skip to main content

Python SDK for the Sendlix gRPC API

Project description

Sendlix Python SDK

This package provides a Python implementation of the Sendlix gRPC SDK that aims for feature parity with the official reference client. It exposes the same high-level clients (EmailClient, GroupClient) and the same authentication helper (Auth).

Installation

pip install sendlix

Authentication

API keys are issued in the format secret.keyId. You can either pass the key string directly to a client or create a reusable Auth instance:

from sendlix import Auth, EmailClient

auth = Auth("sk_xxxxxxxxx.xxx")
email_client = EmailClient(auth)
# or
email_client = EmailClient("sk_xxxxxxxxx.xxx")

The token fetched by Auth is cached until it expires.

Available Clients

EmailClient

Send transactional emails, raw EML messages, or trigger group emails.

Methods:

  • send_email(mail_options, additional_options=None) – send a regular email with to, cc, bcc, html/text, attachments, and inline images.
  • send_eml_email(eml, additional_options=None) – upload raw EML content from a path, bytes, or buffer.
  • send_group_email(group_mail) – broadcast to a predefined Sendlix group.

GroupClient

Manage recipients inside Sendlix groups.

  • insert_email_into_group(group_id, email_records, fail_handling="ABORT")
  • delete_email_from_group(group_id, email)
  • contains_email_in_group(group_id, email)

Each method mirrors the semantics and error handling described in the reference SDK documentation.

Examples

Sending an email

from sendlix import EmailClient

client = EmailClient("sk_xxxxxxxxx.xxx")

response = client.send_email(
    {
        "from": {"email": "sender@example.com", "name": "Sender"},
        "to": ["recipient@example.com"],
        "subject": "Hello World!",
        "html": "<h1>Welcome!</h1><p>This is a test email.</p>",
    }
)
print(response)

Adding emails to a group

from sendlix import GroupClient

group_client = GroupClient("sk_xxxxxxxxx.xxx")

group_client.insert_email_into_group(
    "groupId123",
    [
        {"email": "a@example.com"},
        {
            "email": {"email": "b@example.com", "name": "User B"},
            "substitutions": {"plan": "pro"},
        },
    ],
)

Development

  • Regenerate gRPC stubs: .\build.cmd
  • Run tests: pytest

Local quickstart

If you are working from a clone of this repository (instead of the published pip install sendlix package), make sure you run the code inside the provided virtual environment so that the correct dependency versions (especially protobuf>=5.29.0) are available:

python -m venv .venv
./.venv/Scripts/Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e .[dev]

Running the SDK with an older global installation of google.protobuf (<5.29) will raise an ImportError: cannot import name 'runtime_version' when the generated gRPC stubs are imported. Activating the virtual environment (or upgrading protobuf in your global interpreter) resolves the issue.

The project uses the Apache-2.0 license.

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

sendlix-1.0.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

sendlix-1.0.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sendlix-1.0.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sendlix-1.0.0.tar.gz
Algorithm Hash digest
SHA256 81ff9594c3142152c60582976450b8792c7af982fc84f93cb1ab8936d15e6a30
MD5 340146ebfefabca216372509b319a8cc
BLAKE2b-256 abc993cfb0f89769ea8d206988e742bcb045349fc939c6f1fecfcb5bd964258c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sendlix-1.0.0.tar.gz:

Publisher: release.yml on sendlix/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: sendlix-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sendlix-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08a2dd7bb141dc1d09c31e690c236b260858ee37b96b61c55966030b1482ce39
MD5 c4d7a0a51d2be2125f64fa5f99a9631f
BLAKE2b-256 3757309673c57bd88934d334a36bc62d2e9b68cb108c5fbb19f5898de24feb15

See more details on using hashes here.

Provenance

The following attestation bundles were made for sendlix-1.0.0-py3-none-any.whl:

Publisher: release.yml on sendlix/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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