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.0.tar.gz (7.2 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.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hoplynk-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 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.0.tar.gz
Algorithm Hash digest
SHA256 d529a8bc8ed2d02548f05fefe5f3bae4f6f36fd6c739dbe3d1f17a47a5b5cfe5
MD5 30e96051d4e91b3389939e413802eda9
BLAKE2b-256 c6c354d575560d8c59ea4c845deacd00ef7827672fb15b037888c9b8bfa0d8cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hoplynk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 727bc4c781b38dc9578e2200baf5bca0e1ab7e5756c990553ee2e18c3141e8dc
MD5 149ee42d52b6aa19940819826d0d1107
BLAKE2b-256 b785ffe3fa7ea49d3c9e4be070da0f4327dbb654bf2e3c0f32bfab416f2f212f

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