Skip to main content

Trimis Python SDK

Official Python SDK for Trimis.ro - Send emails, push notifications, and chat messages.

Installation

pip install trimis-python

Quick Start

from trimis import TrimisClient

client = TrimisClient("YOUR_API_KEY")

# Send an email
result = client.send_email(
    to="recipient@example.com",
    from_email="sender@yourdomain.com",
    subject="Hello!",
    html="<h1>Hello World</h1>",
    text="Hello World"
)

if result["success"]:
    print("Email sent!", result["data"])
else:
    print("Error:", result["error"])

Email API

# Send email
result = client.send_email(
    to="user@example.com",
    from_email="noreply@yourdomain.com",
    subject="Welcome!",
    html="<h1>Welcome</h1>",
    text="Welcome",
    track_opens=True,
    track_clicks=True
)

Notification Hub API

# Send notification with template
result = client.send_notification(
    to="user@example.com",
    from_email="noreply@yourdomain.com",
    template="welcome_email",
    variables={
        "name": "John Doe",
        "activation_link": "https://app.com/activate?token=abc123"
    }
)

# Get notification status
notification = client.get_notification("notif_123")

Push Notifications API

# Get VAPID key
vapid = client.get_vapid_key()

# Subscribe user
client.subscribe_push(
    user_id="user123",
    platform="web",
    subscription={
        "endpoint": "https://fcm.googleapis.com/...",
        "keys": {
            "p256dh": "...",
            "auth": "..."
        }
    }
)

# Send push notification
client.send_push(
    user_ids=["user123", "user456"],
    title="New Message",
    body="You have a new message",
    url="https://app.com/messages"
)

Chat API

# Create conversation
conversation = client.create_conversation(
    conversation_type="direct",
    participants=[
        {"user_id": "user1", "name": "Alice"},
        {"user_id": "user2", "name": "Bob"}
    ]
)

# Send message
client.send_message(
    conversation_id=conversation["data"]["conversation_id"],
    sender_id="user1",
    content="Hello!"
)

# Get messages
messages = client.get_messages(conversation["data"]["conversation_id"])

# Mark as read
client.mark_message_read("msg_123", "user2")

Django Integration

# settings.py
TRIMIS_API_KEY = os.getenv("TRIMIS_API_KEY")

# In your views or tasks
from trimis import TrimisClient

client = TrimisClient(settings.TRIMIS_API_KEY)
client.send_email(...)

Flask Integration

from flask import Flask
from trimis import TrimisClient

app = Flask(__name__)
app.config["TRIMIS_API_KEY"] = os.getenv("TRIMIS_API_KEY")

client = TrimisClient(app.config["TRIMIS_API_KEY"])

Error Handling

result = client.send_email(...)

if not result["success"]:
    print(f"Error: {result['error']}")
    print(f"Status: {result.get('status')}")

License

MIT

Links

Metadata

Release files for trimis-python 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trimis-python 1.0.0
File Size Uploaded Provenance
trimis_python-1.0.0.tar.gz 4.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for trimis-python 1.0.0
File Interpreter ABI Platform
trimis_python-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / trimis_python-1.0.0.tar.gz

Download URL trimis_python-1.0.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b793792e0065d3e62d4c060cf355b2cf54013339ad125134a50286db6bc2c554
BLAKE2b-256 checksum
How to use checksums
2d8f31a83d28c51adc9ea3fd0fdcadb0e41f86d2b6043b4f7cca40769cc711fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / trimis_python-1.0.0-py3-none-any.whl

Download URL trimis_python-1.0.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e29e48e3fd70ecdb1ff3d3834a55166f66e274bcd0b6cb8d4ec38ffc0eaab6c6
BLAKE2b-256 checksum
How to use checksums
cc3f7ccafb7d6106bb55cab57685451c35ed23eb8c2d0c9a15f43f3c6153cd96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for trimis-python 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page