A Python client library for interacting with the Autoskope vehicle tracking API.
- Async/await support using aiohttp
- Session management with cookie isolation
- Context manager support for automatic cleanup
- Type hints for better IDE support
- Comprehensive error handling
pip install autoskope-clientimport asyncio
from autoskope_client import AutoskopeApi
async def main():
async with AutoskopeApi(
host="https://portal.autoskope.de",
username="your_username",
password="your_password"
) as api:
# Get all vehicles
vehicles = await api.get_vehicles()
for vehicle in vehicles:
print(f"Vehicle: {vehicle.name}")
if vehicle.position:
print(f" Location: {vehicle.position.latitude}, {vehicle.position.longitude}")
print(f" Speed: {vehicle.position.speed} km/h")
asyncio.run(main())import asyncio
from autoskope_client import AutoskopeApi
async def main():
api = AutoskopeApi(
host="https://portal.autoskope.de",
username="your_username",
password="your_password"
)
try:
await api.connect()
vehicles = await api.get_vehicles()
for vehicle in vehicles:
print(f"Vehicle: {vehicle.name}")
finally:
await api.close()
asyncio.run(main())import asyncio
import aiohttp
from autoskope_client import AutoskopeApi
async def main():
async with aiohttp.ClientSession() as session:
api = AutoskopeApi(
host="https://portal.autoskope.de",
username="your_username",
password="your_password",
session=session # Use external session
)
await api.connect()
vehicles = await api.get_vehicles()
asyncio.run(main())id: Unique identifiername: Vehicle namemodel: Vehicle modelbattery_voltage: Battery voltage in voltsexternal_voltage: External power voltage in voltsgps_quality: GPS quality (HDOP - lower is better)imei: Device IMEIposition: Current position (if available)
latitude: Latitude coordinatelongitude: Longitude coordinatespeed: Speed in km/htimestamp: Position timestampis_parked: Whether vehicle is parked
The library defines two main exception types:
InvalidAuth: Raised when authentication failsCannotConnect: Raised when connection to the API fails
from autoskope_client import AutoskopeApi, InvalidAuth, CannotConnect
try:
async with AutoskopeApi(...) as api:
vehicles = await api.get_vehicles()
except InvalidAuth:
print("Authentication failed. Check credentials.")
except CannotConnect:
print("Could not connect to Autoskope API.")- Python 3.8+
- aiohttp >= 3.8.0
Nico Liebeskind ([email protected])