Skip to main content

An unofficial Python client for the MyGeotab API

Project description

Build Status Documentation Status Code Coverage PyPI Version Python Versions License

An Apache2 Licensed, unofficial Python client for the MyGeotab SDK.

Also bundled is the “myg” command line tool, which is a sandboxed console for quickly querying and operating on MyGeotab data.

Features

  • Automatic serializing and de-serializing of JSON results
  • Clean, Pythonic API for querying data
  • Cross-platform and compatible with Python 2.7.9+, 3.4+, and pypy 4+

Usage

It’s very easy to get started once you’ve registered with MyGeotab:

import mygeotab

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

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

print(devices)

# [{'maxSecondsBetweenLogs': 200.0,
#   'activeTo': '2050-01-01',
#   'minAccidentSpeed': 3.0,
#   'ignoreDownloadsUntil': '1986-01-01',
#   'name': 'Test Device',
#   'idleMinutes': 3.0,
#   ......

If you’re using Python 3.5 and higher, you can also make calls asynchronously via asyncio:

import asyncio
import mygeotab

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

async def get_device():
  return await client.get_async('Device', name='%Test Dev%')

devices = loop.run_until_complete(get_device())
print(devices)

# [{'maxSecondsBetweenLogs': 200.0,
#   'activeTo': '2050-01-01',
#   'minAccidentSpeed': 3.0,
#   'ignoreDownloadsUntil': '1986-01-01',
#   'name': 'Test Device',
#   'idleMinutes': 3.0,
#   ......

Installation

To install the MyGeotab library and command line tool:

$ pip install mygeotab

or for the bleeding-edge version:

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

Documentation

Read the docs at http://mygeotab-python.readthedocs.org

Changes

0.8.0 (2018-06-18)

Improvements

  • Python 3.7 support.
  • Raises an exception when request was not successful.
  • Documentation improvements.

Bug Fixes

  • Since all MyGeotab servers enforce the use of TLS1.2, Python 2.7.9 or greater is required.
  • Fix issue where the password was not provided when retrying authentication. Should better handle #92.

0.6.2 (2017-07-04)

Bug Fixes

  • Revert the change to stop compilation in setup.cfg.

0.6.1 (2017-07-03)

Bug Fixes

  • Don’t compile to prevent issues when installing via setup.py on Python 2.7.

0.6.0 (2017-06-29)

Improvements

  • Configurable timeouts when making calls.
  • Removed verify parameter from API objects as SSL is required when calling a MyGeotab server.
  • Removed run command from the CLI.
  • Removed deprecated API.search and API.search_async methods.
  • Refactored setup.py for async API. The async/awaitable methods are now automatically a part of the API object if using Python 3.5 or higher
  • Code linting and cleanup

0.5.4 (2017-06-05)

Bug Fixes

  • Ensure all dates are timezone aware and are always UTC-localized.

0.5.3 (2017-05-30)

Bug Fixes

  • Fixed intermittent timeout errors due to upstream changes in the ‘requests’ module

0.5.2 (2017-02-02)

Bug Fixes

  • Switched back to using abstract dependencies in setup.py (recommended by this guide)

0.5.1 (2017-01-04)

Bug Fixes

  • Fix for search parameter not being properly handled in ‘get()’ call

0.5 (2017-01-02)

Enhancements

  • Deprecated the ‘search()’ and ‘search_async()’ functions. Replaced by folding the previous functionality into ‘run()’.
  • Removed ‘tzlocal’ dependency. Always deal with dates in UTC by default.
  • Prefer functions instead of making static methods in classes.
  • Added helper to run async calls and collect their results
  • Add ability to quickly run simple python scripts from the ‘myg’ console with no need for any authentication handling. Similar to ‘console’, but for running scripts rather than creating an interactive console.

0.4.4 (2016-07-10)

Enhancements

  • Added the ability to make unauthenticated calls (like “GetVersion”) with the static “API.server_call” method
  • Added asyncio-based API query methods (Python 3.5+ only) into the “ext” package
  • Moved the datafeed to the “ext” package, as well

Bug Fixes

  • MyGeotab never returns 3 digits of milliseconds, so follow that format as well to allow the use of “dates.format_iso_datetime” to create MyGeotab URLs

0.4.2 (2016-03-17)

Bug Fixes

  • Use a custom User-Agent when making requests

0.4 (2016-02-25)

Enhancements

  • Extension for facilitating use of the MyGeotab Data Feed
  • Allow Pythonic underscore-separated parameters mapped to camelcase ones
  • Force the use of TLS 1.2 for upcoming strict security requirements in MyGeotab (Note that TLS 1.2 is only supported in Python 2.7.9+ and 3.4+)

Bug Fixes

  • Fixed issue with CLI console startup
  • Use the system’s default user location for config files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
mygeotab-0.8.0-py2.py3-none-any.whl (17.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3
mygeotab-0.8.0.tar.gz (90.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page