Skip to main content

Official Python SDK for Vehk Axle Fleet Management & Predictive Maintenance Platform

Project description

Vehk Axle Python SDK

Official Python SDK for the Vehk Axle Fleet Management & Predictive Maintenance Platform.

PyPI version Python Version License: MIT

Installation

pip install vehk-axle

Quick Start

from vehk_axle import VehkClient

# Initialize the client with your API key
client = VehkClient(api_key="vehk_your_api_key_here")

# Send telemetry data
response = client.telemetry.send(
    vehicle_id="VH-001",
    sensor_data={
        "speed": 65,
        "rpm": 2500,
        "coolant_temp": 92,
        "fuel_level": 45,
        "battery_voltage": 12.6
    }
)
print(f"Telemetry sent: {response['telemetry_id']}")

# Get ML prediction
prediction = client.predict(
    vehicle_id="VH-001",
    sensor_data={
        "speed": 65,
        "rpm": 2500,
        "coolant_temp": 92
    }
)
print(f"Health Score: {prediction.health_score}%")
print(f"Status: {prediction.health_status.value}")
print(f"Critical: {prediction.is_critical}")

Features

📡 Telemetry Ingestion

Send real-time sensor data from your vehicles:

# Single telemetry point
client.telemetry.send(
    vehicle_id="VH-001",
    sensor_data={"speed": 65, "rpm": 2500},
    timestamp="2026-01-13T10:00:00Z",
    location={"lat": 12.97, "lng": 77.59}
)

# Batch telemetry (up to 100 at a time)
batch_result = client.telemetry.send_batch([
    {"vehicle_id": "VH-001", "sensor_data": {"speed": 65}},
    {"vehicle_id": "VH-002", "sensor_data": {"speed": 70}},
    {"vehicle_id": "VH-003", "sensor_data": {"speed": 55}},
])
print(f"Processed: {batch_result.records_processed}")

🔮 Predictions

Get AI-powered predictions for vehicle health:

# Get prediction
prediction = client.predictions.get(
    vehicle_id="VH-001",
    sensor_data={"speed": 65, "rpm": 2500, "coolant_temp": 92}
)

# Access prediction details
print(f"Health Score: {prediction.health_score}")
print(f"Risk Level: {prediction.risk_level.value}")

# Check maintenance needs
if prediction.needs_maintenance:
    for alert in prediction.maintenance_alerts:
        print(f"⚠️ {alert.type}: {alert.description}")

# Get recommendations
for rec in prediction.recommendations:
    print(f"💡 {rec}")

# List recent predictions
recent = client.predictions.list(vehicle_id="VH-001", limit=10)
for p in recent:
    print(f"{p.vehicle_id}: {p.health_score}%")

🚗 Vehicle Management

List and manage your fleet:

# List all vehicles
vehicles = client.vehicles.list()
for vehicle in vehicles:
    print(f"{vehicle.vehicle_id}: Health {vehicle.health_score}%")

Error Handling

The SDK provides detailed exceptions for different error scenarios:

from vehk_axle import (
    VehkClient,
    VehkAuthenticationError,
    VehkRateLimitError,
    VehkConnectionError,
    VehkAPIError,
)

try:
    client = VehkClient(api_key="vehk_your_key")
    prediction = client.predict("VH-001", {"speed": 65})
    
except VehkAuthenticationError:
    print("Invalid API key. Please check your credentials.")
    
except VehkRateLimitError as e:
    print(f"Rate limit hit. Retry after {e.retry_after} seconds.")
    
except VehkConnectionError:
    print("Could not connect to Vehk API. Check your network.")
    
except VehkAPIError as e:
    print(f"API error [{e.status_code}]: {e.message}")

Configuration

Custom Base URL

For staging or private deployments:

client = VehkClient(
    api_key="vehk_your_key",
    base_url="https://api-staging.vehk.in"
)

Timeout & Retries

client = VehkClient(
    api_key="vehk_your_key",
    timeout=60,        # Request timeout in seconds
    retries=5,         # Number of retries
    retry_delay=2.0    # Delay between retries
)

Context Manager

# Automatically closes the session
with VehkClient(api_key="vehk_your_key") as client:
    prediction = client.predict("VH-001", {"speed": 65})

Health Check

# Check if API is healthy (no auth required)
health = client.health_check()
print(f"Status: {health['status']}")

Supported Sensor Fields

Field Description Unit
speed Vehicle speed km/h
rpm Engine RPM RPM
coolant_temp Coolant temperature °C
fuel_level Fuel level %
battery_voltage Battery voltage V
oil_pressure Oil pressure PSI
throttle Throttle position %
intake_air_temp Intake air temperature °C
ambient_temp Ambient temperature °C
odometer Odometer reading km

Requirements

  • Python 3.8+
  • requests library

Getting Your API Key

  1. Log in to Vehk Dashboard
  2. Go to Settings → API Keys
  3. Click "Generate New Key"
  4. Copy the key (it's only shown once!)

Support

License

MIT License - see LICENSE for details.

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

vehk_axle-1.0.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

vehk_axle-1.0.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file vehk_axle-1.0.0.tar.gz.

File metadata

  • Download URL: vehk_axle-1.0.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vehk_axle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 08c5558afa7075b2351f97db03e2c05e3651d6da781d2052ab70923e3c5be4f8
MD5 60545fbafba056099ae81de933e9ace3
BLAKE2b-256 67a8b42b9359196ecb3ea015750abafae3e431d5af56145b4aec8e6770ccf81c

See more details on using hashes here.

File details

Details for the file vehk_axle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vehk_axle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vehk_axle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55ac1c30d05013224f9ab704ac8b095c94dfe90d366f6208b2a57b0c270bac26
MD5 586db694a09c39e738f195574c3c6d01
BLAKE2b-256 c94465de95d642fa817c9a5f335e8f7f2bf29d411ccfc2a42f45d2592d9e6c65

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