A Python SDK for interacting with Telemetry Harbor ingestion endpoints.
Project description
Telemetry Harbor Python SDK
A modern, production-ready SDK for sending telemetry data to the Telemetry Harbor service from any Python application.
This SDK simplifies data sending by handling HTTP communication, JSON serialization, and robust error handling with automatic retries.
For full details and advanced usage, please see our official documentation at docs.telemetryharbor.com.
Features
- ✅ Pydantic Models for strong validation and ease of use.
- 🔁 Automatic Retries with exponential backoff for network resilience.
- 📦 Batch Support for efficient multi-reading uploads.
- ⚙️ Simple API with intuitive methods like
sendandsend_batch. - 🌐 Universal — works in any Python 3.7+ environment.
Installation
pip install telemetry-harbor-sdk
Quickstart Guide
Here is a basic example of how to use the SDK.
from telemetryharborsdk import HarborClient, GeneralReading
# 1. Initialize the client
client = HarborClient(
endpoint="https://api.telemetry-harbor.com/v1/ingest/{harbor_id}",
api_key="your_secret_api_key"
)
# 2. Create a reading
reading = GeneralReading(
ship_id="MV-Explorer",
cargo_id="C-1138",
value=42.5
)
# 3. Send the reading
response = client.send(reading)
print("Successfully sent data!", response)
# --- Or send a batch ---
batch = [
GeneralReading(ship_id="MV-Explorer", cargo_id="C-1138", value=42.5),
GeneralReading(ship_id="MV-Explorer", cargo_id="temperature", value=21.7),
]
batch_response = client.send_batch(batch)
print("Successfully sent batch!", batch_response)
GPS and Cargo Data Rules
When sending GPS coordinates, send latitude and longitude as separate readings with:
- The same
ship_idandtimestamp. - Distinct
cargo_ids"latitude"and"longitude".
This allows proper grouping in the backend for time-series queries.
Example batch:
[
{
"ship_id": "MV-Explorer",
"cargo_id": "latitude",
"value": 41.123,
"timestamp": "2025-07-17T10:00:00Z"
},
{
"ship_id": "MV-Explorer",
"cargo_id": "longitude",
"value": 29.456,
"timestamp": "2025-07-17T10:00:00Z"
}
]
✅ This enables SQL queries to reconstruct full GPS points by grouping on
ship_idandtimestamp.
Query example (PostgreSQL/TimescaleDB):
SELECT
time,
MAX(value) FILTER (WHERE cargo_id = 'latitude') AS latitude,
MAX(value) FILTER (WHERE cargo_id = 'longitude') AS longitude,
ship_id
FROM cargo_data
WHERE $__timeFilter(time)
AND ship_id IN (${ship_id:sqlstring})
AND cargo_id IN ('latitude', 'longitude')
GROUP BY time, ship_id
ORDER BY time;
API Reference
HarborClient(endpoint, api_key, max_retries=5, initial_backoff=1.0)
Create a new client instance.
endpoint(str): Telemetry Harbor ingestion URL.api_key(str): Your API key.max_retries(int, optional): Retry attempts on failure (default 5).initial_backoff(float, optional): Initial backoff in seconds (default 1.0).
send(reading: GeneralReading)
Send a single telemetry reading.
send_batch(readings: List[GeneralReading])
Send multiple readings in a batch.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telemetryharborsdk-0.1.7.tar.gz.
File metadata
- Download URL: telemetryharborsdk-0.1.7.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4223a84dcebdc94e6944302a9923302e0e2d79c383a3a853e250715472767250
|
|
| MD5 |
5bd02d5aa9a22e7d2ca47d9f1ffb7164
|
|
| BLAKE2b-256 |
dde28a4f1f2c6ef818a058dda1c96bc4a9acd36c2d357b5c9e2d7f49772a267f
|
Provenance
The following attestation bundles were made for telemetryharborsdk-0.1.7.tar.gz:
Publisher:
publish-to-pypi.yml on TelemetryHarbor/harbor-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telemetryharborsdk-0.1.7.tar.gz -
Subject digest:
4223a84dcebdc94e6944302a9923302e0e2d79c383a3a853e250715472767250 - Sigstore transparency entry: 281345879
- Sigstore integration time:
-
Permalink:
TelemetryHarbor/harbor-sdk-python@47f0364c4046631ded9330b08c98984882d55ed5 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/TelemetryHarbor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@47f0364c4046631ded9330b08c98984882d55ed5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file telemetryharborsdk-0.1.7-py3-none-any.whl.
File metadata
- Download URL: telemetryharborsdk-0.1.7-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8091fbf9b58b9e9d101e07b0dd477570348980d8c57c3c513573c396e1830de7
|
|
| MD5 |
72d00040d4e88d6734195d452104d43d
|
|
| BLAKE2b-256 |
82266c88759f60b9bae4f471a91651239cc665a06a89dedc14fc32a53e86a5e6
|
Provenance
The following attestation bundles were made for telemetryharborsdk-0.1.7-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on TelemetryHarbor/harbor-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telemetryharborsdk-0.1.7-py3-none-any.whl -
Subject digest:
8091fbf9b58b9e9d101e07b0dd477570348980d8c57c3c513573c396e1830de7 - Sigstore transparency entry: 281345898
- Sigstore integration time:
-
Permalink:
TelemetryHarbor/harbor-sdk-python@47f0364c4046631ded9330b08c98984882d55ed5 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/TelemetryHarbor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@47f0364c4046631ded9330b08c98984882d55ed5 -
Trigger Event:
push
-
Statement type: