Skip to main content

A Python client for the MyGeotab SDK

Project description

Build Status Documentation Code Coverage PyPI Version Python Versions License

A Python client for the MyGeotab SDK.

Features

  • Automatic serializing and deserializing of API call results

  • Clean, Pythonic API for querying data

  • Cross-platform and compatible with Python 3.7+

  • A myg command-line tool for interactively working with data in a terminal

Usage

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

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,
#   ......

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.9.2 (2024-10-08)

Improvements

  • Updates Altitude API call method #124.

0.9.1 (2024-04-05)

Bug Fixes

  • Loads system CA certificates when creating an SSL context #123.

0.9.0 (2024-02-23)

Improvements

  • Removed all Python 2 handling code and packages (six).

  • Simplified code based on removing support for Python 2 and Python 3.6 and lower.

Bug Fixes ls - Support results limit in get requests #11. - Handles ArgumentException when extending the session #19.

Housecleaning

  • Changed linter to ruff and enabled additional linters.

  • Ensured proper mypy types installed for 3rd party packages.

0.8.8 (2022-09-14)

Improvements

  • Use the highest TLS version available (at least TLS 1.2) when making calls.

Bug Fixes

  • Fix for recursive hasattr call when serializing objects #7.

0.8.7 (2021-11-11)

Improvements

  • Added support for client-side certificates #1.

  • Console improvements using ptpython (if installed) and better handling of sessions.

0.8.6 (2021-03-15)

Improvements

  • Added new experimental API class (in the mygeotab.ext module) for more intuitive ways of using results from client.get() like get_dataframe() to easily get a Pandas DataFrame from the result set.

  • Adds support for using with proxies #327.

  • Calling authenticate() on an API instance more than once no longer results in an error #328.

Bug Fixes

  • Handle ConnectionError as errors in feed extension rather than crashing #130.

  • Remove extraneous “search” parameter from API.get().

0.8.5 (2019-10-07)

Bug Fixes

  • Fixes issue with warnings from Arrow about date parsing #306.

0.8.4 (2019-08-22)

Bug Fixes

  • Fixes issue with serialization of datetime.date objects #284.

0.8.3 (2019-08-19)

Improvements

  • Use the high-performance python-rapidjson library to serialize and deserialize JSON parameters and responses in Python 3.5+ #268.

Bug Fixes

  • Silence warnings from arrow parsing when the library is used interactively or in a Jupyter notebook.

Housecleaning

  • Added serialization benchmarking in CircleCI tests.

  • Remove PyPy test config.

0.8.2 (2019-06-10)

Bug Fixes

  • Remove asyncio-specific default arguments preventing from importing this pacakge in a Python 3.5+ thread #236.

0.8.1 (2019-06-03)

Improvements

  • Return content with a non-JSON content type as text

Bug Fixes

  • Handle serialization of very old dates #121.

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.

Source Distribution

mygeotab-0.9.2.tar.gz (177.0 kB view details)

Uploaded Source

Built Distribution

mygeotab-0.9.2-py2.py3-none-any.whl (29.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mygeotab-0.9.2.tar.gz.

File metadata

  • Download URL: mygeotab-0.9.2.tar.gz
  • Upload date:
  • Size: 177.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for mygeotab-0.9.2.tar.gz
Algorithm Hash digest
SHA256 855f8f43e2a3cd729ecbff515339c00732095c15998fcfe0a25632c28a2700e7
MD5 724269248ff39623ab99cb1fb86b5027
BLAKE2b-256 72ac1059f1512278612901a1dcf625cd5ca91e97fec30e8c1b7c4101e6f10770

See more details on using hashes here.

File details

Details for the file mygeotab-0.9.2-py2.py3-none-any.whl.

File metadata

  • Download URL: mygeotab-0.9.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for mygeotab-0.9.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 791e280addffb56cfc02cc649d998158936e228fd187abf746f5b4cccf192e08
MD5 28d9475c7b5b14e10d4002387b3634b6
BLAKE2b-256 3652b9b8ff1c6a551489b60bd96ca3da2ec20b2bd88b5dbc89ee5c1b8023af83

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page