Skip to main content

Python client for Orchepy - A lightweight, domain-agnostic event orchestrator

Project description

Orchepy Python Client

A Python client library for Orchepy - A lightweight, domain-agnostic event orchestrator for workflow automation.

Features

  • 🚀 Async-first - Built on httpx for high-performance async operations
  • 🔒 Type-safe - Full type hints and Pydantic models
  • 📦 Simple API - Clean, intuitive interface matching Orchepy's REST API
  • 🎯 Lightweight - Minimal dependencies

Installation

pip install orchepy-client

Quick Start

import asyncio
from orchepy_client import OrchepyClient

async def main():
    client = OrchepyClient(base_url="http://localhost:3296")

    # Create a workflow
    workflow = await client.create_workflow(
        name="Sales Pipeline",
        phases=["Lead", "Qualified", "Proposal", "Closed"],
        initial_phase="Lead",
    )

    # Create a case
    case = await client.create_case(
        workflow_id=workflow["id"],
        data={
            "customer": "Acme Corp",
            "value": 50000,
            "contact": "john@acme.com"
        }
    )

    # Move case to next phase
    await client.move_case(
        case_id=case["id"],
        to_phase="Qualified",
        reason="Customer showed interest"
    )

    # Update case data
    await client.update_case_data(
        case_id=case["id"],
        data={"value": 75000}
    )

    # Get case info
    case_info = await client.get_case(case["id"])
    print(f"Case is now in phase: {case_info['current_phase']}")

asyncio.run(main())

API Reference

Client Initialization

from orchepy_client import OrchepyClient

client = OrchepyClient(
    base_url="http://localhost:3296",
    timeout=10.0  # optional, defaults to 10.0 seconds
)

Workflows

# Create workflow
workflow = await client.create_workflow(
    name="My Workflow",
    phases=["Phase 1", "Phase 2"],
    initial_phase="Phase 1",
    active=True,
    webhook_url="https://example.com/webhook"  # optional
)

# Get workflow
workflow = await client.get_workflow(workflow_id)

# List workflows
workflows = await client.list_workflows()

Cases

# Create case
case = await client.create_case(
    workflow_id="workflow-uuid",
    data={"field": "value"},
    metadata={"source": "api"}  # optional
)

# Get case
case = await client.get_case(case_id)

# List cases
cases = await client.list_cases(
    workflow_id="workflow-uuid",  # optional
    current_phase="Phase 1",      # optional
    status="active"                # optional
)

# Move case
await client.move_case(
    case_id="case-uuid",
    to_phase="Phase 2",
    reason="Moving forward",      # optional
    triggered_by="user-123"       # optional
)

# Update case data
await client.update_case_data(
    case_id="case-uuid",
    data={"new_field": "new_value"}
)

# Get case history
history = await client.get_case_history(case_id)

Error Handling

from orchepy_client import OrchepyClientError

try:
    case = await client.get_case("invalid-id")
except OrchepyClientError as e:
    print(f"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

orchepy_client-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

orchepy_client-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file orchepy_client-0.1.0.tar.gz.

File metadata

  • Download URL: orchepy_client-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for orchepy_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 934ba5dbae053b8d5dccc605c443bb1e32bfaaf2a6afa5c70cc1b2b4fd3a0520
MD5 4172f1ac2087b613f4a39eaddb2210ac
BLAKE2b-256 c494e9195a694862aa559c7a09c8bea1504e9d7315981cac021a544f311fa077

See more details on using hashes here.

File details

Details for the file orchepy_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: orchepy_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for orchepy_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7eb8f237bc47f88f8699faaed541bd2d7200bd36eb5fa99e7fcdbe7092c1155
MD5 4e71244c07ca0d8bf7eb1b19d1824b2b
BLAKE2b-256 3e6fb14e1420d85889f5136c95a6c5a9d928118b86cf07d612130b32e2fc1a1b

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