GeoTrack Pro Python SDK
SDK officiel Python pour l'API GeoTrack Pro — plateforme de géolocalisation de flotte, logistique et géofencing.
Installation
pip install geotrack-sdk
Démarrage rapide
import asyncio
from geotrack import GeoTrackClient
async def main():
async with GeoTrackClient(api_key="gt_votre_cle_api") as client:
# Lister les véhicules en ligne
devices = await client.devices.list(is_online=True)
print(f"{devices.total} véhicules en ligne")
for device in devices.items:
print(f" {device.name} — {device.last_position}")
# Historique de positions des dernières 24h
from datetime import datetime, timedelta, timezone
now = datetime.now(timezone.utc)
positions = await client.devices.get_positions(
device_id=devices.items[0].id,
from_dt=(now - timedelta(hours=24)).isoformat(),
to_dt=now.isoformat(),
)
print(f"{len(positions)} positions récupérées")
asyncio.run(main())
Ressources disponibles
Devices
# Lister avec filtres
devices = await client.devices.list(page=1, page_size=50, is_online=True)
# Détail d'un device
device = await client.devices.get("uuid-du-device")
# Positions sur une plage
positions = await client.devices.get_positions("uuid", from_dt="...", to_dt="...")
# Résumé de trajets
trips = await client.devices.get_trip_summary("uuid", from_dt="...", to_dt="...")
Alertes
# Lister les alertes récentes
alerts = await client.alerts.list(page=1, alert_type="overspeed")
# Marquer comme lue
await client.alerts.acknowledge("alert-uuid")
Colis (Last-Mile)
# Créer un colis
parcel = await client.parcels.create(
tracking_code="TRACK-001",
recipient_name="Jean Dupont",
recipient_phone="+22891000000",
destination_address="Lomé, Togo",
)
# Mettre à jour le statut
await client.parcels.update_status(parcel.id, status="out_for_delivery")
# Lister par statut
parcels = await client.parcels.list(status="pending")
Webhooks
from geotrack import WebhookHandler
handler = WebhookHandler(secret="votre_secret_webhook")
# Dans votre endpoint FastAPI / Flask :
@app.post("/webhook/geotrack")
async def handle_webhook(request: Request):
payload = await request.body()
signature = request.headers.get("X-GeoTrack-Signature")
event = handler.parse(payload, signature)
print(f"Événement : {event.type} — Device : {event.device_id}")
return {"ok": True}
Gestion des erreurs
from geotrack import GeoTrackError, AuthError, RateLimitError, QuotaError, NotFoundError
try:
device = await client.devices.get("uuid-invalide")
except NotFoundError:
print("Device introuvable")
except RateLimitError as e:
print(f"Rate limit — réessayer dans {e.retry_after}s")
except AuthError:
print("Clé API invalide ou expirée")
except QuotaError:
print("Quota mensuel dépassé — mettre à niveau le plan")
except GeoTrackError as e:
print(f"Erreur API : {e}")
Auto-hébergement
client = GeoTrackClient(
api_key="gt_...",
base_url="https://votre-instance.com/api/v1",
)
Générer une clé API
- Connectez-vous sur geo.lsgrouptogo.com
- Paramètres → API Keys → Créer une clé
- Copiez la clé (affichée une seule fois)
Liens
Licence
MIT — voir LICENSE
Metadata
Release files for geotrack-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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geotrack_sdk-1.0.0.tar.gz | 7.8 kB | Without provenance | Details for geotrack_sdk-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geotrack_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for geotrack_sdk-1.0.0-py3-none-any.whl |
Total release size: 19.9 kB
Release files / geotrack_sdk-1.0.0.tar.gz
| Download URL | geotrack_sdk-1.0.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cde780bacb8661b2fc4ae66f7c9d617a2d0153c8a464b229ad6423addc4836f
|
|
BLAKE2b-256 checksum How to use checksums |
3dccd4cdff51ee64c7b2b5c5f43dea339430b9aa680434d614d0fb33c2473cca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / geotrack_sdk-1.0.0-py3-none-any.whl
| Download URL | geotrack_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1203a899f3c7f77d7d150b2bde0e317f840677db4b039c81e0672c729b74a9cc
|
|
BLAKE2b-256 checksum How to use checksums |
e434594bd3c42b5c507f4183743f832fe064a424529746c0af05538d72e4b92c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for geotrack-sdk 1.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.