Easy access for TrackUnit REST API
Project description
TrackUnitPython
Python API for Trackunit
What is this package
This packages contains some usefull functions for an easy interface to TrackUnit's REST API. For information to the data see here.
Features:
- caches requests for faster access
- for timespan's bigger than 30 days it sufficiantly devides it into allowd requests
For more features write an issue here. Pull requests are welcome.
How to use
Install
Install the package via pip
pip install pytrackunit
Create a file in your execution directory with the name api.key
which contains your TrackUnit API token. If that doesnt work for you, you can set the token in the constructor by calling tu = TrackUnit(api_key="<your key>")
.
Example
from pytrackunit.helper import *
from pytrackunit.TrackUnit import TrackUnit
# Create the API
# It loads the key from api.key by default
tu = TrackUnit()
# Get all vehicles from trackunit
# This is executing the 'Unit' request
vehicles = tu.get_unitlist()
# Get history is executing 'Report/UnitHistory'
# Gets the history for the last 100 days
history = tu.get_history(vehicles[0]['id'],100)
# Get extended data 'Report/UnitExtendedInfo'
# Gets the history for the last 100 days
data = tu.get_candata(vehicles[0]['id'],100)
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
pytrackunit-1.0.0.tar.gz
(17.1 kB
view hashes)
Built Distribution
Close
Hashes for pytrackunit-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90289042e820c6dfd8414d20223ac348821d1f2b3ea821d7237f9cf7c95b767e |
|
MD5 | 57faae7a1fcaeac439ae101a7c060364 |
|
BLAKE2b-256 | 2121daeafa53aad45285416607a32d55b505442d01a4190af79803d8bb578615 |