Skip to main content

Netradyne Python SDK

Official Python client for the Netradyne Driveri Platform API. The SDK provides a typed, dataclass-based interface grouped by swagger tags.

Version: 1.0.0
Requires: Python 3.10+

Install name driveri-python-sdk
Import module netradyne_sdk

Installation

Published to PyPI. No extra index configuration is required.

pip install driveri-python-sdk==1.0.0

Editable install from source:

pip install -e .

Quickstart

Authenticate with OAuth 2.0 client credentials, then call a tenant endpoint. The client targets the production API by default—no base URL required.

from_client_credentials resolves a Bearer access token automatically: it reuses an existing active token when one is available (the API allows at most two active tokens per client), otherwise it generates a new one. Basic credentials are retained on the client for OAuth endpoints that require them.

from netradyne_sdk import NetradyneClient
from netradyne_sdk.models.get_alerts_request import GetAlertsRequest

client = NetradyneClient.from_client_credentials(
    "CLIENT_ID",
    "CLIENT_SECRET",
    tenant_unique_name="my-tenant",
)

response = client.alerts.get_alerts(
    request=GetAlertsRequest(offset=0, limit=10, start_time=1_700_000_000_000),
)
# Every API method returns NetradyneResponse[T] with HTTP metadata and a typed body.
alerts = response.body.data
status = response.status_code
headers = response.headers  # keys normalized to lowercase

Pass None (or omit) for tenant_unique_name on tenant API calls to use the default tenant set on the client ("my-tenant" in from_client_credentials). Request timeout defaults to 30 seconds; pass timeout= to the client constructor or factory methods to override.

Authentication

Factory Use when
NetradyneClient.from_client_credentials(...) You have a client ID and secret; Bearer token is resolved automatically
NetradyneClient.from_basic_token(...) You already have Base64-encoded clientId:clientSecret, or a full Basic ... header value
NetradyneClient(...) You already have a Bearer access token

Both credential factories follow the same token resolution flow:

  1. GET /v1/auth/tokens with Basic auth to list active tokens
  2. Reuse the active token with the latest expiry, if any
  3. Otherwise POST /v1/auth/token with Basic auth to generate a new token

After initialization, tenant API calls send a lowercase bearer token in the Authorization header. Access Token methods that manage tokens (generate_access_token, get_active_access_tokens, revoke_access_token_by_id) always use Basic auth; revoke_access_token uses the client's Bearer token.

from netradyne_sdk import NetradyneClient

# Pre-encoded Basic credentials (Base64 only, or full "Basic ..." header)
client = NetradyneClient.from_basic_token(
    "BASE64_CLIENT_ID_COLON_SECRET",
    tenant_unique_name="my-tenant",
)

# Existing Bearer token (no automatic token management)
client = NetradyneClient(
    token="ACCESS_TOKEN",
    tenant_unique_name="my-tenant",
)

Configuration

Use NetradyneConfig for production, sandbox, or a custom endpoint:

from netradyne_sdk import NetradyneClient, NetradyneConfig

# Production (default) — https://api.netradyne.com/driveri
prod = NetradyneClient.from_client_credentials(
    "CLIENT_ID",
    "CLIENT_SECRET",
    tenant_unique_name="my-tenant",
)

# Sandbox — https://api-demo.netradyne.com/driveri
sandbox = NetradyneClient.from_client_credentials(
    "CLIENT_ID",
    "CLIENT_SECRET",
    config=NetradyneConfig.sandbox(),
    tenant_unique_name="my-tenant",
)

# Custom base URL with an existing access token
custom = NetradyneClient(
    config=NetradyneConfig.with_base_url("https://example.com/driveri"),
    token="ACCESS_TOKEN",
    tenant_unique_name="my-tenant",
)
Factory Base URL
NetradyneConfig.production() https://api.netradyne.com/driveri
NetradyneConfig.sandbox() https://api-demo.netradyne.com/driveri
NetradyneConfig.with_base_url(url) Custom URL

Each config also sets Accept-Language (default en-US) on outgoing requests.

API surface

NetradyneClient is the single entry point. Grouped API clients mirror swagger tags:

Client Description
client.access_token Access token generate/list/revoke
client.accessories Accessories
client.alerts Alerts
client.coaching_sessions Coaching sessions
client.configurations Tenant and fleet configuration
client.devices Devices
client.drive_time_assignment Driver assignment
client.drivers Drivers
client.event_access Video / event access
client.fleet Fleet and tenant mapping
client.fleet_tracking Trips and geofences
client.fuel_management Fuel transactions
client.green_zone_score GreenZone scores
client.groups Groups and hierarchy
client.inspections Inspections
client.live_streaming Live streaming
client.live_tracking Live vehicle location
client.reports Driver reports
client.sandbox Sandbox mock-data endpoints
client.users Users
client.vehicle_data Vehicle data
client.vehicle_locator Last known location
client.vehicles Vehicles
client.webhook_management Webhooks

Method names match swagger operationIds (for example get_alerts, get_vehicles_details).

Request bodies use dataclass types (for example GetAlertsRequest(...)). Each API method returns a NetradyneResponse envelope with:

Field Description
status_code HTTP status code from the server
headers Response headers (keys normalized to lowercase)
body Typed API payload (for example data, error, pagination fields)

Low-level NetradyneClient.request() returns the same envelope; body is parsed JSON (dict/list) instead of a typed model.

Request models and validation

Request models are plain dataclasses (or dicts coerced to dataclasses). Constructing a model validates required fields and common API constraints before the HTTP call is made. Invalid requests raise ValueError from the model or API method with a descriptive message.

A common constraint across tenant APIs is the vehicle identifier rule: pass either vehicle_number (or vin / vin_number on some models), not both. This is enforced on models such as:

Request Where enforced
CreateVideoRequest __post_init__
GetVehiclesDetailsRequest / GetVehiclesDetailsV2Request __post_init__
GetAllDriverAssignmentRequest __post_init__
from netradyne_sdk.models.create_video_request import CreateVideoRequest

# Valid — vehicle number only
request = CreateVideoRequest(
    start_time=1_700_000_000_000,
    duration=60_000,
    vehicle_number="TRUCK-101",
)

# Raises ValueError — both identifiers set
CreateVideoRequest(
    start_time=1_700_000_000_000,
    duration=60_000,
    vehicle_number="TRUCK-101",
    vin="1HGBH41JXMN109186",
)

Query-parameter models omit None fields when serialized via netradyne_sdk.query.to_query. Supported vehicle_data filter keys for last-known vehicle data are documented on GetLastKnownVehiclesDataRequest.

VehiclesApi example

The example below calls get_vehicles_details to fetch vehicle, camera, and fleet information. Pass either vehicle_number or vin_number on the request (not both):

from netradyne_sdk import NetradyneClient, NetradyneError
from netradyne_sdk.models.get_vehicles_details_request import GetVehiclesDetailsRequest
from netradyne_sdk.models.vehicle_result_response import VehicleResultResponse

client = NetradyneClient.from_client_credentials(
    "CLIENT_ID",
    "CLIENT_SECRET",
    tenant_unique_name="my-tenant",
)

request = GetVehiclesDetailsRequest(vehicle_number="TRUCK-101")

try:
    response = client.vehicles.get_vehicles_details(request=request)
    print(response.body.data)
    print(response.status_code)
    print(response.headers)
except NetradyneError as exc:
    print(f"HTTP status: {exc.status}")
    print(f"Error message: {exc}")
    print(f"Response headers: {exc.headers}")
    print(f"Response body: {exc.body}")
except ValueError as exc:
    # Client-side validation before the HTTP call
    print(f"Validation error: {exc}")
except Exception as exc:
    print(f"Unexpected error: {exc}")

API documentation

Regenerate the SDK reference after API changes:

python scripts/generate_reference_md.py

Error handling

Failed HTTP responses (status >= 400) raise NetradyneError after retries are exhausted. Use exc.status for the HTTP status code, exc.headers for response headers (keys normalized to lowercase), str(exc) for a short summary, and exc.body for the parsed response body (typically JSON).

Client-side validation and other failures raise ValueError or a generic Exception (for example network or parsing errors). Catch NetradyneError first, then a broader handler for everything else:

from netradyne_sdk import NetradyneError

try:
    client.alerts.get_alerts(request=request)
except NetradyneError as exc:
    print(f"HTTP status: {exc.status}")
    print(f"Response headers: {exc.headers}")
    print(f"Error message: {exc}")
    print(f"Response body: {exc.body}")
except ValueError as exc:
    print(f"Validation error: {exc}")
except Exception as exc:
    print(f"Unexpected error: {exc}")

Not every 4xx or 5xx response is retried. Only transient status codes are retried: 429 (rate limit) and 500, 502, 503, and 504. Other 4xx responses (for example 400, 401, 403, 404) fail immediately with NetradyneError. Retries use exponential backoff (honoring Retry-After when present); the default is up to 3 retries with a 500 ms initial backoff.

License

Licensed under the Apache License, Version 2.0. See LICENSE.

Metadata

Release files for driveri-python-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for driveri-python-sdk 1.0.0
File Size Uploaded
driveri_python_sdk-1.0.0.tar.gz 169.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for driveri-python-sdk 1.0.0
File Interpreter ABI Platform
driveri_python_sdk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 625.4 kB

Release files / driveri_python_sdk-1.0.0.tar.gz

Download URL driveri_python_sdk-1.0.0.tar.gz
Size 169.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ebb67413847b06e508a67e74fcffdf647c1c702326fe50f1664dd1ebb09667db
BLAKE2b-256 checksum
How to use checksums
5da3fa74d90d6565873c7babcc8992920fa9ca7570542d3a0513131838019d90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / driveri_python_sdk-1.0.0-py3-none-any.whl

Download URL driveri_python_sdk-1.0.0-py3-none-any.whl
Size 456.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2ed3c1ae5cf9925ffd9a3e6fe7eef0b1f5cafe521bae4baa92811e342c7ae79
BLAKE2b-256 checksum
How to use checksums
a9e7d77d5c0ee96e6c7805d40e333ba5c53ce7bd89c19a7ba1aa21bfb5a43846
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page