wiki:Developer_Lib_Python

MoosTrax Library for Python

Source Download:  http://www.moostrax.com/static/pymoostrax.tar.gz

Installation

setuptools

sudo easy_install http://www.moostrax.com/static/pymoostrax.tar.gz

source

wget http://www.moostrax.com/static/pymoostrax.tar.gz
tar -xvzf pymoostrax.tar.gz
cd pymoostrax
python setup.py install

Usage

demo.py

import moostrax
from datetime import datetime

mt = moostrax.MoosTrax('API_KEY')

# Get all the devices
devices = mt.getDevices()

for device in devices:
    print 'Device ID: ' + str(device)
    
    # get device info
    print mt.getDeviceInfo(device)
    
    # get last location
    print mt.getLocation(device)
    
    # history
    try:
        print 'Num History: ' + str(len(mt.getHistory(device, startDate=datetime(2008,11,1),endDate=datetime(2008,11,2))))
    except:
        print 'No History'