Skip to main content

Python client for FlowWatch — connect to a running FlowWatch sidecar

Project description

flowwatch-client (Python)

Python client for FlowWatch — connects to a running FlowWatch sidecar over HTTP.

Install

pip install flowwatch-client

Usage

Start the FlowWatch sidecar in your Node.js app:

import { createFlowwatch, startSidecar } from "@pranshulsoni/flowwatch"

const fw = await createFlowwatch({ ... })
startSidecar(fw, { port: 9400, token: process.env.SIDECAR_TOKEN })

Then use the Python client:

from flowwatch import FlowwatchClient

fw = FlowwatchClient(base_url="http://localhost:9400", token="your-token")

# Feature flag
enabled = fw.flag("new-checkout", context={"userId": "u_123", "plan": "pro"})

# Trigger a workflow
result = fw.trigger("send-welcome-email", input={"userId": "u_123"})

# Record a trace span
fw.trace_span(name="db.query", type="db", duration_ms=42)

# Capture an error
fw.capture_error(message="Something broke", source="api", name="ValueError")

# Health check
status = fw.health()  # {"status": "ok", "sidecar": "flowwatch"}

fw.close()

Use as a context manager:

with FlowwatchClient("http://localhost:9400", token="your-token") as fw:
    enabled = fw.flag("dark-mode")

API

Method Description
flag(key, context?) Evaluate a feature flag → bool
trigger(name, input?) Trigger a workflow → dict
trace_span(name, type, duration_ms, metadata?, status?) Record a trace span
capture_error(message, source, name?, stack?) Capture an error
health() Sidecar health check → dict
close() Close the HTTP connection

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

pranshulsoni_flowwatch-3.1.3.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

pranshulsoni_flowwatch-3.1.3-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file pranshulsoni_flowwatch-3.1.3.tar.gz.

File metadata

  • Download URL: pranshulsoni_flowwatch-3.1.3.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pranshulsoni_flowwatch-3.1.3.tar.gz
Algorithm Hash digest
SHA256 f561a5d3c9b492e629748de7cd96606ca8dd1500099bb39b36fe9fe335335b07
MD5 0cd4c64857cad3faeecaf8c3fdaee89b
BLAKE2b-256 4dac59fc8f73ace4a70967b8c98863432da3231d7c64156a5f4b09f21b033424

See more details on using hashes here.

File details

Details for the file pranshulsoni_flowwatch-3.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pranshulsoni_flowwatch-3.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d1efdefc7d24a4ab2b99a860b78ef31792bda26c837ffaa96fa830bf80696ad1
MD5 e924bd056b17e01c9eeae9bf0f6e35e6
BLAKE2b-256 3f9a7f5a9f006f3837c82f68398f874de297c04ab8e4aeebf1608853e98b3672

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