Skip to main content

genieos — Python SDK

PyPI version

The official Python SDK for GenieOS. Sync and async clients, typed responses (Pydantic), automatic idempotency, retry-on-429/5xx with exponential back-off, and webhook signature verification.

Install

pip install genieos

Requires Python 3.9+ and httpx>=0.27, pydantic>=2.6.

Quickstart (sync)

API keys are minted in Settings → API keys. Production keys look like gos_live_…; sandbox keys look like gos_test_…. Put the secret in GENIEOS_API_KEY (never commit it).

from genieos import GenieOS

with GenieOS(api_key="gos_live_...") as gos:
    ws = gos.workspace.get()
    print(ws.name, "on", ws.plan)

    send = gos.templates.send(
        "welcome",
        to="aki@example.com",
        variables={"firstName": "Aki"},
    )
    print("queued:", send.id)

The API key is also picked up from the GENIEOS_API_KEY env var, matching the Node SDK and CLI.

Quickstart (async)

import asyncio
from genieos import AsyncGenieOS

async def main():
    async with AsyncGenieOS() as gos:  # GENIEOS_API_KEY env var
        await gos.events.emit(
            "subscription.cancelled",
            email="aki@example.com",
            traits={"tier": "pro", "reason": "moving to weekly"},
        )

asyncio.run(main())

Webhook verification (Flask)

import os
from flask import Flask, request, abort
from genieos import verify_webhook, WebhookSignatureError

app = Flask(__name__)

@app.post("/genieos/webhook")
def webhook():
    try:
        delivery = verify_webhook(
            request.get_data(as_text=True),
            request.headers,
            secret=os.environ["GENIEOS_WEBHOOK_SECRET"],
        )
    except WebhookSignatureError as e:
        abort(400, str(e))

    if delivery.type == "send.delivered":
        ... # handle it
    return "", 204

verify_webhook rejects out-of-window timestamps (default ±5 min) and performs constant-time signature comparison. The same module exposes sign_webhook for local testing.

Error handling

from genieos import (
    GenieOSRateLimitError,
    GenieOSValidationError,
    GenieOSAuthError,
)

try:
    gos.events.emit("checkout.completed", email="aki@example.com")
except GenieOSRateLimitError as e:
    time.sleep(e.retry_after_seconds)
except GenieOSValidationError as e:
    log.warning("422: %s", e.body)
except GenieOSAuthError:
    rotate_my_key()

All SDK errors inherit from GenieOSError and expose .code, .status, .request_id, .body.

License

MIT

Metadata

Release files for genieos 0.1.1

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

Source distribution (sdist)

Source distribution for genieos 0.1.1
File Size Uploaded Provenance Actions
genieos-0.1.1.tar.gz 21.4 kB With provenance Details for genieos-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for genieos 0.1.1
File Interpreter ABI Platform Actions
genieos-0.1.1-py3-none-any.whl Python 3 none any Details for genieos-0.1.1-py3-none-any.whl

Total release size: 46.4 kB

Release files / genieos-0.1.1.tar.gz

Download URL genieos-0.1.1.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1f5371931a4a628805c970ecd6ecadc79494f5be436cb66a1a5228edaa0a17a4
BLAKE2b-256 checksum
How to use checksums
87415ef84fd74fba2d79e9174cfac652fc12f703f418825a9379158f20a62976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Release files / genieos-0.1.1-py3-none-any.whl

Download URL genieos-0.1.1-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11a48aee0ed81270244847a61b3b963b326f9ac4ab11d4137aaaef1c2bfe5484
BLAKE2b-256 checksum
How to use checksums
c6b8e31bb6b9fa6d400bc59ee506daf635b56d9fe8f6cc28ba7257a73ea20cda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

Security for genieos 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for genieos-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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