• Joined on 2025-10-11

conduit-client (0.2.0)

Published 2026-07-05 17:32:42 -05:00 by chelsea

Installation

pip install --index-url  conduit-client

About this package

Python client for the Conduit / Mega API gateway.

conduit-client

Python client for the Conduit / Mega API gateway at https://api.cowtunnel.com.

The client covers the stable gateway surface:

  • health
  • Swagger UI/OpenAPI retrieval
  • service catalog and service health
  • auth login/callback and current actor information
  • API key lifecycle
  • admin key/audit inspection
  • key-management UI HTML retrieval
  • SMS/MMS facade helpers
  • MeTube ingestion facade helpers
  • Jellyfin media library facade helpers
  • Transmission torrent facade helpers
  • Proxmox compute facade helpers
  • BIND9 DNS facade helpers
  • custom namespace registration for future provider facades

Provider request/response bodies are intentionally permissive where backend schemas are still evolving.

Install

python -m pip install -e .

For Gitea package registry publishing/install instructions, see PUBLISHING.md.

Configuration

The client reads these environment variables:

MEGA_API_BASE_URL  default: https://api.cowtunnel.com
MEGA_API_KEY       API key for protected endpoints
MEGA_API_TIMEOUT   default: 30

The default auth header is:

Authorization: Bearer <MEGA_API_KEY>

X-API-Key is also supported:

from conduit import Client

client = Client(api_key="...", auth_header="x-api-key")

Quick Start

from conduit import Client

client = Client.from_env()

print(client.health())
print(client.openapi())
print(client.auth.me())
print(client.services.list())
print(client.services.health())

Provider Examples

SMS with the configured default sender DID:

client.sms.send("7068442742", "hi")

SMS with an explicit sender DID:

client.sms.send("7068442742", "hi", did="15551234567")

MMS:

client.sms.send_mms(
    "7068442742",
    "image",
    media1="https://example.test/image.png",
)

DNS:

client.dns.server_status()
client.dns.zone("example.org")
client.dns.batch_update_records("example.org", [
    {"action": "add", "name": "www", "type": "A", "ttl": 300, "value": "192.0.2.10"},
])

Media:

client.media.ingest.jobs()
client.media.ingest.create_job("https://example.test/video")
client.media.library.search(term="matrix", limit=5)

Torrents:

client.torrents.list()
client.torrents.start(7)

Compute:

client.compute.resources(type="vm")
client.compute.start_vm(100)

Destructive helpers require explicit confirmation:

client.dns.delete_zone("example.org", confirm="example.org")
client.compute.delete_vm(100, confirm=100)
client.torrents.remove(7, confirm=7, delete_local_data=False)

API Keys

created = client.keys.create(
    display_name="automation",
    scopes=["gateway:read"],
)

print(created["key_prefix"])

client.keys.revoke(created["key_prefix"])

The raw created key is returned by the gateway once. Do not log it.

Admin

logs = client.admin.audit(limit=10, result="success")
keys = client.admin.keys()

These calls require the relevant scopes on the API key and key owner.

Raw Requests

The typed provider namespaces are intentionally not filled in until provider operation paths are confirmed. Advanced callers can still use the shared transport:

data = client.request("GET", "/dns/servers/default/status")

Prefer typed methods once they exist.

Extensibility

Custom namespaces can be registered without changing the core client:

from conduit.namespaces import Namespace


class CustomNamespace(Namespace):
    def status(self):
        return self._get("/custom/status")


client.register_namespace("custom", CustomNamespace)
print(client.custom.status())

Safety

Destructive provider methods should require explicit confirmation arguments when they are added. The current core gateway client does not hide write operations behind convenience helpers.

Requirements

Requires Python: >=3.10
Details
PyPI
2026-07-05 17:32:42 -05:00
10
Chelsea
MIT
32 KiB
Assets (2)
Versions (6) View all
0.2.4 2026-07-08
0.2.3 2026-07-08
0.2.2 2026-07-05
0.2.1 2026-07-05
0.2.0 2026-07-05