Python: Moving Intelligence
Basic Python 3 API wrapper for Moving Intelligence asset and fleet management
About
This package allows you to get get data from https://movingintelligence.com/en/.
NOTE: You need a login account together with an apikey to be able to use it.
Installation
pip3 install pymovingintelligence
Example code
#!/usr/bin/env python3
from pymovingintelligence import MovingIntelligence, InvalidAuthError, InvalidPermissionsError
import logging
import sys
import json
import time
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
try:
## Init
# Initialize API client with your login name and apikey
api = MovingIntelligence(
username="YOUR USERNAME",
apikey="YOUR APIKEY",
)
## Misc data
# Get trip classifications
classifications = api.get_trip_classifications()
logger.info(classifications)
# Get trip periods
periods = api.get_trip_periods()
logger.info(periods)
## Person data
# Get all persons
persons = api.get_persons()
logger.info(persons)
for person in persons:
person_id = person["id"]
name = person["name"]
# Get trips for person
logger.info("Get trips for %s", name)
logger.info(api.get_person_trips(person_id, 'TODAY', 'UNKNOWN'))
logger.info("Get detailed trips for %s", name)
logger.info(api.get_person_detailed_trips(person_id, 'TODAY', 'UNKNOWN'))
## Object data
# Get all objects
objects = api.get_objects()
logger.info(objects)
for object in objects:
object_id = object["id"]
brand = object["brand"]
model = object["model"]
logger.info("Get odometer readings for %s %s", brand, model)
logger.info(api.get_odometer(object_id))
logger.info("Get trips for %s %s", brand, model)
logger.info(api.get_object_trips(object_id, 'TODAY', 'UNKNOWN'))
logger.info("Get detailed trips for %s %s", brand, model)
logger.info(api.get_object_detailed_trips(object_id, 'TODAY', 'UNKNOWN'))
except InvalidAuthError:
logger.debug("Authenticaton error, your username and/or apikey is invalid.")
except InvalidPermissionsError:
logger.debug("You don't have permission to access this data.")
except (Exception) as err:
logger.debug("Unknown error occurred. %s", err)
Metadata
Release files for pymovingintelligence 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pymovingintelligence-0.0.7.tar.gz | 5.0 kB | Details |
Release files / pymovingintelligence-0.0.7.tar.gz
| Download URL | pymovingintelligence-0.0.7.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4bb91465248edc4308691c11ba65613f99d44372141cbd26b5a69bc6f88ae525
|
|
BLAKE2b-256 checksum How to use checksums |
6c40efa415d2d29c79eb0ceb16257b1244115ff40032535b896c3d14bd6941c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7
|