Skip to content

Geotab/mygeotab-python

Repository files navigation

MyGeotab

Build Status Documentation Code Coverage PyPI Version Python Versions License

A Python client for the MyGeotab SDK.

Features

  • Automatic serialization and deserialization of API call results
  • Clean, Pythonic API for querying, adding, updating, and removing entities
  • Both synchronous and async/await interfaces
  • Cross-platform and compatible with Python 3.10+
  • myg command-line tool for interactively exploring data in a terminal

Installation

$ pip install mygeotab

For the latest development version:

$ pip install git+https://github.com/geotab/mygeotab-python

Usage

Synchronous

import mygeotab

client = mygeotab.API(
    username='hello@example.com',
    password='mypass',
    database='MyDatabase',
)
client.authenticate()

devices = client.get('Device', name='%Test Dev%')
print(devices)

# [{'name': 'Test Device',
#   'maxSecondsBetweenLogs': 200.0,
#   'activeTo': '2050-01-01',
#   ...}]

Asynchronous

import asyncio
import mygeotab

async def main():
    client = mygeotab.API(
        username='hello@example.com',
        password='mypass',
        database='MyDatabase',
    )
    client.authenticate()

    devices = await client.get_async('Device', name='%Test Dev%')
    print(devices)

asyncio.run(main())

Command-line tool

The myg tool opens an interactive Python console pre-loaded with an authenticated API object:

$ myg console MyDatabase

# Inside the console, `myg` is the active API object:
>>> myg.get('Device', name='%Test%')

Manage saved sessions:

$ myg sessions --list
$ myg sessions remove MyDatabase

Documentation

Full API reference and guides are at https://mygeotab-python.readthedocs.io/en/latest/.

License

Apache 2.0. See LICENSE for details.

About

A Python client for the MyGeotab API.

Topics

Resources

License

Stars

20 stars

Watchers

5 watching

Forks

Packages

 
 
 

Contributors

Languages