Skip to main content

Python adapter SDK for emitting events to the Morphe OS

Project description

morphe-adapter-sdk

Python adapter SDK for emitting events to the Morphe OS.

Installation

pip install morphe-adapter-sdk

Quick start

import asyncio
from morphe_adapter_sdk import MorpheClient

async def main():
    async with MorpheClient(token="your-token") as client:
        result = await client.emit({
            "event_type": "dataops.v1.sync_failed",
            "system_id":  "your-system-uuid",
            "payload":    {"records_failed": 42, "source": "warehouse"},
        })
        print(result)

asyncio.run(main())

Event type format

event_type accepts two formats:

  • Fully-qualified (always works): "namespace.version.event_name", e.g. "dataops.v1.sync_failed"
  • Bare name (when event_namespace is configured): "sync_failed" — Morphe OS prepends the configured namespace automatically. Requires that system_id maps to a registered Morphe system with event_namespace set; if not, the bare name is stored unchanged.

When in doubt, use the fully-qualified form.

Configuration

Parameter Type Default Description
token str required API token from your Morphe workspace
hmac_secret str None Optional HMAC secret for request signing
validate_schema bool False Validate payload against event schema before emit
endpoint str https://api.morphe.io Override for self-hosted deployments
max_retries int 3 Number of retries on transient network errors

Error handling

from morphe_adapter_sdk import MorpheClient
from morphe_adapter_sdk.errors import ApiError, NetworkError, SchemaValidationError

async with MorpheClient(token="your-token") as client:
    try:
        await client.emit(event)
    except SchemaValidationError as e:
        print("Schema errors:", e.errors)
    except ApiError as e:
        print(f"API error {e.status_code}: {e.message}")
    except NetworkError as e:
        print("Network error:", e)

License

MIT

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

morphe_adapter_sdk-1.0.5.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

morphe_adapter_sdk-1.0.5-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file morphe_adapter_sdk-1.0.5.tar.gz.

File metadata

  • Download URL: morphe_adapter_sdk-1.0.5.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.12.12 HTTPX/0.28.1

File hashes

Hashes for morphe_adapter_sdk-1.0.5.tar.gz
Algorithm Hash digest
SHA256 635fce14f042497e6e513e92bbca7958a6b673dfe486a9abee29645e4b71160e
MD5 f871ca03363deea2b1021ec80b09bc1e
BLAKE2b-256 a6e905a1a7f2dae706178917dfa3b1ddf5a01fc37dd61ae65cff4fe2d5a85cd5

See more details on using hashes here.

File details

Details for the file morphe_adapter_sdk-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: morphe_adapter_sdk-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.12.12 HTTPX/0.28.1

File hashes

Hashes for morphe_adapter_sdk-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5aebbc0634c8ee78dd608fd50fbf4c12262d90b6f5ec527a3a055c37250be005
MD5 9320af3ce067cad1587afed231582b55
BLAKE2b-256 abf79821cffc6686b3062d00eaca99e3873bf7e660359c241538ee63e193794e

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