netsware-sdk
Official Python SDK for the Netsware API: Business Hours,
Scheduled Jobs, and Webhooks. Pure standard library, no dependencies.
Install
pip install netsware-sdk
Quickstart
from netsware import Netsware, verify_webhook
client = Netsware("nw_live_xxx")
# Is a business open right now?
status = client.hours.check(timezone="Asia/Kolkata", country="IN")
print(status["open"])
# Create a business-hours schedule
sched = client.hours.create_schedule(
name="Mumbai office",
days=["MON", "TUE", "WED", "THU", "FRI"],
open_time="09:00",
close_time="18:00",
timezone="Asia/Kolkata",
country="IN",
)
# Combine schedules, switch one off, list countries and regions
client.hours.schedule_stats() # {"schedules": {total, active, ...}}
client.hours.resolve_schedules([sched["id"], other_id], match="all") # open only if all are open
client.hours.set_schedule_active(sched["id"], False) # off, hours unchanged
client.hours.countries()
client.hours.regions("US")
# Schedule a one-time job
job = client.jobs.schedule(
name="Send reminder",
url="https://example.com/webhook",
run_at="2026-07-01T09:00:00",
timezone="Asia/Kolkata",
payload={"user_id": "123"},
)
# Register a webhook (one event per registration)
hook = client.webhooks.register(
product="scheduled_jobs",
event="job.completed",
url="https://example.com/events",
)
Verifying webhook signatures
Pass the raw request body string for a byte-exact check:
ok = verify_webhook(
payload=raw_body, # raw request body (string)
signature=headers["X-Netsware-Signature"],
timestamp=headers["X-Netsware-Timestamp"],
secret="whsec_...",
)
if not ok:
... # reject
Groups, variables, runs & metrics
# Organize jobs into groups
g = client.groups.create("Nightly")
client.groups.rename(g["id"], "Nightly batch")
# Reusable values + secrets (secret values are WRITE-ONLY: list() returns value=None)
client.variables.set("API_BASE_URL", "https://api.acme.io")
client.variables.set("API_TOKEN", "t0ken", is_secret=True)
# What's broken everywhere? (status is required; success has no account-wide feed)
failing = client.runs.list(status="failed", since="24h")
# Per-job history filtered by outcome (retention-clamped)
errs = client.jobs.logs(job["id"], status="failed")
if errs["logs"] and errs["logs"][0].get("run_id"):
run = client.jobs.run(job["id"], errs["logs"][0]["run_id"]) # one run, every attempt
# Daily monitoring rollups for your own NOC/monitor (default 30d, plan-clamped)
m = client.metrics.get(window="30d")
print(m["totals"]["runs"], m["current"]["active_jobs"])
Configuration
client = Netsware("nw_live_xxx", base_url="https://app.netsware.com", timeout=30.0)
Full API reference: https://netsware.com/docs.
MIT © Netsware Cloud Solutions LLP