🐍 Python SDK JS JavaScript SDK

SDK רשמי
Python + JavaScript

ספריות client מוכנות לשימוש לחיבור מהיר לפלטפורמת Water & Energy Engineering API

🐍

yehuda-water-sdk

Python SDK — PyPI

v1.0.0 Python ≥ 3.9

התקנה

pip install yehuda-water-sdk
Pump Tests — שליחה ושליפה
Telemetry batch ingest
Reports PDF download
Async support (asyncio)
Retry logic מובנה
Type hints מלאות

דוגמת קוד — שליחת בדיקת נצילות

from yehuda_water_sdk import WaterEnergyClient
from yehuda_water_sdk.models import PumpTest
from datetime import datetime

# אתחול הלקוח
client = WaterEnergyClient(api_key="wek_live_xxxxxxxxxxxx")

# שליחת תוצאת בדיקה
result = client.pump_tests.create(PumpTest(
  station_id="ST-MEI-001",
  pump_id="P-003",
  test_date=datetime.now(),
  flow_m3h=285.4,
  head_m=42.8,
  power_kw=45.2
))

print(f"נצילות: {result.efficiency_pct}%") # נצילות: 78.3%
print(f"SEC: {result.sec_kwh_m3} kWh/m³") # SEC: 0.441 kWh/m³
print(f"סטטוס: {result.regulatory_status}") # סטטוס: PASS

Async — טעינת נתוני תחנות

import asyncio
from yehuda_water_sdk import AsyncWaterEnergyClient

async def get_all_stations():
  async with AsyncWaterEnergyClient(api_key="wek_live_xxx") as client:
    stations = await client.stations.list(status="active")
    for station in stations:
      print(f"{station.name}: {station.avg_efficiency_pct}%")

asyncio.run(get_all_stations())

Telemetry — שליחת Batch

from yehuda_water_sdk.models import SensorReading

readings = [
  SensorReading(sensor_id="FLOW-001", metric="flow_m3h", value=283.1),
  SensorReading(sensor_id="PWR-001", metric="power_kw", value=44.8),
]

result = client.telemetry.ingest(gateway_id="GW-DALTON-01", readings=readings)
print(f"קלטנו {result.ingested} נקודות")
github.com/yehuda-buju/yehuda-water-sdk
Python SDK — Source code, Issues, PRs
בקרוב
JS

@yehuda-water/sdk

JavaScript / TypeScript SDK — npm

v1.0.0 Node ≥ 18 | Browser

התקנה

npm install @yehuda-water/sdk
yarn add @yehuda-water/sdk
TypeScript types מלאות
Promise + async/await
WebSocket telemetry stream
Browser + Node.js תמיכה
Auto-retry + exponential backoff
Tree-shakeable, ESM + CJS

דוגמת קוד — שליחת בדיקה

import { WaterEnergyClient } from '@yehuda-water/sdk';

const client = new WaterEnergyClient({
  apiKey: 'wek_live_xxxxxxxxxxxx'
});

// שליחת תוצאת בדיקת נצילות
const result = await client.pumpTests.create({
  stationId: 'ST-MEI-001',
  pumpId: 'P-003',
  testDate: new Date(),
  flowM3h: 285.4,
  headM: 42.8,
  powerKw: 45.2
});

console.log(`נצילות: ${result.efficiencyPct}%`); // נצילות: 78.3%
console.log(`סטטוס: ${result.regulatoryStatus}`); // סטטוס: PASS

TypeScript — Types מובנים

import { WaterEnergyClient, PumpTestResult, Station } from '@yehuda-water/sdk';

const client = new WaterEnergyClient({ apiKey: process.env.WATER_API_KEY! });

// TypeScript knows the shape of every response
const stations: Station[] = await client.stations.list({ status: 'active' });

stations.forEach((s: Station) => {
  if (s.avgEfficiencyPct < 65) {
    console.warn(`⚠ ${s.name} — נצילות נמוכה: ${s.avgEfficiencyPct}%`);
  }
});

Telemetry Stream — WebSocket

// Subscribe to real-time telemetry stream
const stream = client.telemetry.stream({
  gatewayId: 'GW-DALTON-01',
  sensors: ['FLOW-001', 'PWR-001', 'PRESS-001']
});

stream.on('reading', (reading) => {
  console.log(`[${reading.sensorId}] ${reading.metric}: ${reading.value}`);
});

stream.on('anomaly', (alert) => {
  console.error(`🚨 אנומליה: ${alert.description}`);
});

stream.connect();
// stream.disconnect(); // לסגירה

Webhook Handler — Node.js Express

import express from 'express';
import { verifyWebhookSignature } from '@yehuda-water/sdk';

const app = express();
app.use(express.raw({ type: 'application/json' }));

app.post('/hooks/water-energy', (req, res) => {
  const valid = verifyWebhookSignature(
    req.body,
    req.headers['x-wek-signature'] as string,
    process.env.WEBHOOK_SECRET!
  );
  if (!valid) return res.status(401).send('Unauthorized');

  const event = JSON.parse(req.body.toString());
  console.log(`אירוע: ${event.event}`);
  res.status(200).json({ received: true });
});

app.listen(3000);
github.com/yehuda-buju/yehuda-water-sdk-js
JavaScript/TypeScript SDK — Source code, Issues, PRs
בקרוב

השוואת SDK

תכונה 🐍 Python JS JavaScript
Pump Tests API
Stations API
Telemetry Batch Ingest
WebSocket Stream
Reports PDF Download
Webhook Signature Verification
TypeScript / Type Hints
Async SupportasyncioPromise
Browser Support
Package Managerpip / poetrynpm / yarn / pnpm

מוכן להתחיל?

קבל API Key בחינם ובנה את האינטגרציה הראשונה שלך תוך דקות.

pip install yehuda-water-sdk | npm install @yehuda-water/sdk
יהודה בוז'ו · מהנדס מים ואנרגיה · סוקר אנרגיה מוסמך · + שנות ניסיון · Est. 1996 · ח.פ 514240720 · 050-885-5593 · [email protected]