Skip to content

Commit acccf47

Browse files
author
Marius Schlueter
committed
added some readme
1 parent a0ce6af commit acccf47

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,46 @@ Python API for Trackunit
77
![example workflow](https://github.com/einsteinmaster/TrackUnitPython/actions/workflows/pylint.yml/badge.svg)
88

99
![example workflow](https://github.com/einsteinmaster/TrackUnitPython/actions/workflows/python-publish.yml/badge.svg)
10+
11+
## What is this package
12+
13+
This packages contains some usefull functions for an easy interface to TrackUnit's REST API. For information to the data see [here](https://dev.trackunit.com/docs).
14+
15+
Features:
16+
- caches requests for faster access
17+
- for timespan's bigger than 30 days it sufficiantly devides it into allowd requests
18+
19+
For more features write an issue [here](https://github.com/einsteinmaster/TrackUnitPython/issues/new). Pull requests are welcome.
20+
21+
## How to use
22+
23+
### Install
24+
25+
Install the package via pip
26+
27+
`pip install pytrackunit`
28+
29+
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>")`.
30+
31+
### Example
32+
33+
```
34+
from pytrackunit.helper import *
35+
from pytrackunit.TrackUnit import TrackUnit
36+
37+
# Create the API
38+
# It loads the key from api.key by default
39+
tu = TrackUnit()
40+
41+
# Get all vehicles from trackunit
42+
# This is executing the 'Unit' request
43+
vehicles = tu.get_unitlist()
44+
45+
# Get history is executing 'Report/UnitHistory'
46+
# Gets the history for the last 100 days
47+
history = tu.get_history(vehicles[0]['id'],100)
48+
49+
# Get extended data 'Report/UnitExtendedInfo'
50+
# Gets the history for the last 100 days
51+
data = tu.get_candata(vehicles[0]['id'],100)
52+
```

0 commit comments

Comments
 (0)