Skip to main content

Official Python SDK for the Hoplynk API

Project description

hoplynk

Official Python SDK for the Hoplynk API.

Stream live GPS and telemetry from Starlink-connected vehicles — no direct network access to the vehicle required.

Install

pip install hoplynk

Quickstart

import os
from hoplynk import HoplynkClient

client = HoplynkClient(api_key=os.environ["HOPLYNK_API_KEY"])

Get an API key from the Hoplynk dashboard. Keys are prefixed hlk_.


REST API

List assets in a kit

assets = client.get_assets(kit_id)
for asset in assets:
    print(asset["id"], asset["name"], asset["type"])

Get latest GPS fix

loc = client.get_location(kit_id, asset_id)
if loc:
    print(loc.lat, loc.lon, loc.source)  # e.g. 'starlink'
    print("stale:", loc.stale)

Get full telemetry snapshot

snap = client.get_telemetry(kit_id, asset_id)
if snap.gps:
    print(snap.gps.lat, snap.gps.lon)
if snap.status:
    print(snap.status.downlink_mbps, "Mbps down")

Get Starlink link status

status = client.get_status(kit_id, asset_id)
if status:
    print(f"downlink: {status.downlink_mbps} Mbps")
    print(f"latency:  {status.pop_ping_latency_ms} ms")
    if status.alerts:
        print("alerts:", status.alerts)

WebSocket streaming

For live updates without polling:

with client.stream(kit_id, asset_id, feeds=["gps", "status"]) as stream:
    for event in stream:
        if event["feed"] == "gps":
            p = event["payload"]
            print(f"GPS  {p['lat']:.6f}, {p['lon']:.6f}  source={p['source']}")
        elif event["feed"] == "status":
            p = event["payload"]
            print(f"Link {p.get('downlink_mbps')} Mbps ↓  {p.get('uplink_mbps')} Mbps ↑")

The stream auto-reconnects on disconnect. Exits the with block only when you call stream.close() or break out of the loop.

Without context manager

stream = client.stream(kit_id, asset_id)
for event in stream:
    process(event)
    if done:
        stream.close()
        break

Context manager for the client

with HoplynkClient(api_key=os.environ["HOPLYNK_API_KEY"]) as client:
    loc = client.get_location(kit_id, asset_id)
    print(loc.lat, loc.lon)

Types

GpsPayload

Field Type Description
lat float Latitude (degrees)
lon float Longitude (degrees)
alt_m float | None Altitude (meters, WGS-84)
accuracy_m float | None Horizontal accuracy (meters)
source str 'starlink' / 'starlink_cached' / 'cellular' / 'manual'
stale bool True if GPS fix is older than 30s
timestamp str | None ISO 8601 UTC

StatusPayload

Field Type Description
downlink_mbps float | None Download throughput
uplink_mbps float | None Upload throughput
pop_ping_latency_ms float | None Latency to Starlink POP
pop_ping_drop_rate float | None Packet drop rate (0–1)
obstruction_pct float | None Sky obstruction percentage
alerts list[str] Active Starlink alerts

Environment variables

Variable Description
HOPLYNK_API_KEY Your hlk_* API key

IDs

You'll need a Kit ID and Asset ID for each vehicle. Find them in the Hoplynk dashboard, or call client.get_assets(kit_id) to discover them programmatically.


License

MIT

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

hoplynk-0.2.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

hoplynk-0.2.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file hoplynk-0.2.1.tar.gz.

File metadata

  • Download URL: hoplynk-0.2.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hoplynk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1f8fc9801bade7c4dada118800c67041e5d0bcc49ec1a56d3f67da568abcd967
MD5 96bb516ec78b91c1dc1860667f454d98
BLAKE2b-256 48163f62c9c75c5a555375163b1ac4993c720d380ecf933ab96e8420d8b0f5de

See more details on using hashes here.

File details

Details for the file hoplynk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: hoplynk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for hoplynk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bdb05a607024d7c9e29f459cb18a8ad2ee597235eb45876df478280dadec95d7
MD5 d46eafd831cf7df93ab9d651cfb0560b
BLAKE2b-256 97290726f4c04f5a2a1016203044f6b4c602fabd41df8173ab5fc5e2c716aa55

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