Registry / http-networking / mygeotab

mygeotab

JSON →
library0.9.8pypypi✓ verified 22d ago

The `mygeotab` library is a Python client for the MyGeotab SDK, providing a clean, Pythonic API for interacting with the MyGeotab telematics platform. It handles automatic serialization and deserialization of API call results and is compatible with Python 3.9+. As of version 0.9.4, it continues to be actively developed with frequent releases addressing improvements and bug fixes.

pip install mygeotab
INSTALL
IMPORT
SIG · MYGEOTAB
M
mygeotab
http-networkingpythonv0.9.8
Install
6.6s avg
Import
941ms
Disk
55MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.966s · 54.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.6s · import 0.916s · 56MB
55MB installed
● package 55MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

API
from mygeotab import API

This quickstart demonstrates how to initialize the `mygeotab` client, authenticate using environment variables, and perform basic API calls such as retrieving devices and checking API version information. It handles potential authentication failures gracefully.

import os from mygeotab import API # Retrieve credentials from environment variables for security USERNAME = os.environ.get('MYGEOTAB_USERNAME', 'your_username@example.com') PASSWORD = os.environ.get('MYGEOTAB_PASSWORD', 'your_password') DATABASE = os.environ.get('MYGEOTAB_DATABASE', 'YourDatabaseName') if USERNAME == 'your_username@example.com' or PASSWORD == 'your_password': print("Please set MYGEOTAB_USERNAME, MYGEOTAB_PASSWORD, and MYGEOTAB_DATABASE environment variables.") else: try: # Initialize the API client client = API(username=USERNAME, password=PASSWORD, database=DATABASE) # Authenticate the client client.authenticate() print(f"Successfully authenticated to database: {DATABASE}") # Example: Get the first 5 devices devices = client.get('Device', resultsLimit=5) print(f"Retrieved {len(devices)} devices:") for device in devices: print(f" - Device ID: {device.get('id')}, Name: {device.get('name')}") # Example: Get version information (unauthenticated call example, though client is authenticated) version_info = client.call('GetVersion') print(f"API Version: {version_info.get('apiVersion')}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingVersion 0.9.0 dropped support for Python 2.x and Python 3.6. Ensure your environment uses Python 3.7 or newer to avoid compatibility issues.
fix
Upgrade your Python environment to 3.7+ and then upgrade the `mygeotab` library to 0.9.0 or later: `pip install --upgrade mygeotab`.
affects: < 0.9.0
deprecatedThe `API.search()` and `API.search_async()` methods were deprecated in v0.5.0 and subsequently removed in v0.6.0. Their functionality was integrated into the `client.get()` method by using the `search` parameter.
fix
Replace calls like `client.search('Device', name='%Test Dev%')` with `client.get('Device', search={'name': '%Test Dev%'})`.
affects: 0.5.0 - 0.5.x
gotchaWhen constructing JSON parameters for API calls, ensure all property names and string values are enclosed in double quotes. Using single quotes (e.g., `{'name': 'value'}` instead of `{"name": "value"}`) will result in a `Geotab.Serialization.JsonSerializerException` error from the MyGeotab API as of release 5.7.2103.
fix
Always use double quotes for JSON keys and string values within your API call parameters, for example: `client.get('Device', search={'name': 'MyDevice'})`.
affects: All (API-side enforcement since MyGeotab 5.7.2103)
gotchaIf you already have a `session_id`, `client.authenticate()` should generally only be called if the existing `session_id` is invalid or expired (e.g., after an `InvalidUserException`). Repeatedly calling `authenticate()` with a valid `session_id` is often unnecessary and can lead to unexpected behavior or deprecated method warnings (specifically, the undocumented usage of `Authenticate` with an authenticated credentials object was deprecated around MyGeotab 9.0 on the API side). The `ExtendSession()` method (on the API) is for extending sessions.
fix
Implement logic to check for session validity before authenticating. If `session_id` is present and valid, proceed directly to API calls. Only call `authenticate()` when starting a new session or re-authenticating after an `InvalidUserException`. The `mygeotab` library's `client.authenticate()` should handle the standard username/password flow correctly, but be mindful when integrating with existing session IDs.
affects: All
Errors
Common errors & fixes
Authentication failed: {"error":{"message":"Incorrect login credentials","code":-32000,"data":{"id":"...","type":"InvalidUserException","requestIndex":0},"name":"JSONRPCError","errors":[{"message":"Incorrect login credentials","name":"InvalidUserException"}]},"jsonrpc":"2.0","id":1,"requestIndex":0}
The username, password, database, or server URL provided to the MyGeotab API client are incorrect, or the account may be locked due to multiple failed login attempts.
fix
Verify that the username, password, database name, and server URL are precisely correct. Ensure the MyGeotab account is not locked out. In `mygeotab`, these parameters are passed to the `API` constructor: `api = mygeotab.API(username='your_username', password='your_password', database='your_database', server='my.geotab.com')` then `api.authenticate()`.
This method has been deprecated, and requires a custom code to be used. please use new methode 'ExtendSessionAsync' to extend your session.
An attempt was made to authenticate or extend a session using a deprecated method, often when a session ID was provided directly to the `authenticate()` method instead of the dedicated session extension method.
fix
Instead of re-authenticating with an existing session ID, use the `extend_session` method to refresh an active session. `api.extend_session(database='your_database', session_id=existing_session_id, user_name='your_username')`.
429 Too Many Requests
The application has exceeded the API rate limits set by the MyGeotab platform, meaning too many requests were sent within a short period.
fix
Implement a retry mechanism with exponential backoff to reduce the frequency of API calls after receiving this error. Review Geotab API documentation for specific rate limits and adjust the application's call frequency accordingly.
Invalid session @ ...
The session ID used for API calls has either expired due to inactivity, been invalidated by a system event, or the maximum number of concurrent sessions for the user has been exceeded.
fix
Re-authenticate to obtain a new valid session ID. If maintaining long-lived sessions, regularly call `api.extend_session()` before the session expires to keep it active.
Upgrade
Version history
0.9.8latest on PyPI · released Jul 16, 2026
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the MyGeotab API.
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
mygeotab — pip install mygeotab · libregistry