gps_tracker package

Subpackages

Module contents

Unofficial client to retrieve location data from Invoxia™ GPS trackers.

class gps_tracker.AsyncClient(config: Config, session: aiohttp.ClientSession | None = None)[source]

Bases: object

Asynchronous client for Invoxia API.

async close()[source]

Close current session.

classmethod get_auth(config: Config) aiohttp.BasicAuth[source]

Form the authentication instance associated to a config.

async get_device(device_id: int) Device[source]

Return a device referenced by its id.

Parameters:

device_id (int) – Unique identifier of a device

Returns:

Device instance of given id

Return type:

Device

async get_devices(kind: str | None = None) List[Device][source]

Return devices associated to credentials.

By default, all devices (included associated smartphones) are returned. The kind parameter allows to filter only devices of a given type (‘android’, ‘iphone’ or ‘tracker’).

Parameters:

kind (str, optional) – kind of devices to retrieve

Returns:

List of retrieved devices

Return type:

List[Device]

async get_locations(device: Tracker, not_before: datetime | None = None, not_after: datetime | None = None, max_count: int = 20) List[TrackerData][source]

Extract the list of tracker locations.

Parameters:
  • device (Tracker) – The tracker instance whose locations must be extracted.

  • not_before (datetime.datetime, optional) – Minimum date-time of the locations to extract.

  • not_after (datetime.datetime, optional) – Maximum date-time of the locations to extract.

  • max_count (int, optional) – Maximum count of position to extract. Note that one API query yields 20 locations.

Returns:

List of extracted locations

Return type:

List[TrackerData]

async get_tracker_config(device: Tracker) TrackerConfig[source]

Get the current configuration of a given tracker.

Parameters:

device (Tracker) – The tracker instance whose configuration is queried.

Returns:

Current config of the tracker

Return type:

TrackerConfig

async get_tracker_status(device: Tracker) TrackerStatus[source]

Get the current status of a given tracker.

Parameters:

device (Tracker) – The tracker instance whose status is queried.

Returns:

Current status of the tracker

Return type:

TrackerStatus

async get_trackers() List[Tracker][source]

Query API for the list of trackers associated to credentials.

Returns:

Tracker devices associated to current account

Return type:

List[Tracker]

async get_user(user_id: int) User[source]

Return a user referenced by its id.

Parameters:

user_id (int) – ID of the user to retrieve

Returns:

User instance associated to given ID

Return type:

User

async get_users() List[User][source]

Return all users associated to credentials.

The API definition seems to indicate that multiple users can be associated to a single account (probably for pro subscriptions). For public consumers, this methods will return a single user.

Returns:

List of User instances associated to account

Return type:

List[User]

class gps_tracker.Client(config: Config)[source]

Bases: object

Synchronous client for Invoxia API.

get_device(device_id: int) Device[source]

Return a device referenced by its id.

Parameters:

device_id (int) – Unique identifier of a device

Returns:

Device instance of given id

Return type:

Device

get_devices(kind: str | None = None) List[Device][source]

Return devices associated to credentials.

By default, all devices (included associated smartphones) are returned. The kind parameter allows to filter only devices of a given type (‘android’, ‘iphone’ or ‘tracker’).

Parameters:

kind (str, optional) – kind of devices to retrieve

Returns:

List of retrieved devices

Return type:

List[Device]

get_locations(device: Tracker, not_before: datetime | None = None, not_after: datetime | None = None, max_count: int = 20) List[TrackerData][source]

Extract the list of tracker locations.

Parameters:
  • device (Tracker) – The tracker instance whose locations must be extracted.

  • not_before (datetime.datetime, optional) – Minimum date-time of the locations to extract.

  • not_after (datetime.datetime, optional) – Maximum date-time of the locations to extract.

  • max_count (int, optional) – Maximum count of position to extract. Note that one API query yields 20 locations.

Returns:

List of extracted locations

Return type:

List[TrackerData]

get_tracker_config(device: Tracker) TrackerConfig[source]

Get the current configuration of a given tracker.

Parameters:

device (Tracker) – The tracker instance whose configuration is queried.

Returns:

Current config of the tracker

Return type:

TrackerConfig

get_tracker_status(device: Tracker) TrackerStatus[source]

Get the current status of a given tracker.

Parameters:

device (Tracker) – The tracker instance whose status is queried.

Returns:

Current status of the tracker

Return type:

TrackerStatus

get_trackers() List[Tracker][source]

Query API for the list of trackers associated to credentials.

Returns:

Tracker devices associated to current account

Return type:

List[Tracker]

get_user(user_id: int) User[source]

Return a user referenced by its id.

Parameters:

user_id (int) – ID of the user to retrieve

Returns:

User instance associated to given ID

Return type:

User

get_users() List[User][source]

Return all users associated to credentials.

The API definition seems to indicate that multiple users can be associated to a single account (probably for pro subscriptions). For public consumers, this methods will return a single user.

Returns:

List of User instances associated to account

Return type:

List[User]

class gps_tracker.Config(username: str, password: str, api_url: str = 'https://labs.invoxia.io')[source]

Bases: object

Configuration for API Clients.

api_url: str

Invoxia API URL.

classmethod default_api_url() str[source]

Return the default API URL.

password: str

Password used as credentials on Invoxia account.

username: str

Username used as credentials on Invoxia account.

class gps_tracker.Device(id, created: str | None, name, version, *, timezone=None)[source]

Bases: object

Base class for devices.

created: datetime

Datetime of device registration.

static get(device_data: dict[str, Any]) Device[source]

Generate a Device object based on its type.

classmethod get_types() Iterable[str][source]

Return list of registered device types.

id: int

Device unique identifier.

name: str

Device name.

timezone: str | None

Timezone associated to device.

version: str

Device version.

class gps_tracker.Tracker(id, created: str | None, name, version, *, timezone=None)[source]

Bases: Device

Base class for trackers.

created: datetime

Datetime of device registration.

id: int

Device unique identifier.

name: str

Device name.

timezone: str | None

Timezone associated to device.

version: str

Device version.

class gps_tracker.TrackerData(datetime: str | None, lat, lng, method, pkt_drop, precision, uuid)[source]

Bases: object

Definition of tracker location data.

datetime: datetime

Datetime of location measurement.

lat: float

Device latitude.

lng: float

Device longitude.

method: TrackerMethod

Method used for location acquisition.

pkt_drop: int

To be determined. (Probably number of packet drop since last location).

precision: int

Precision of location measurement (To be confirmed).

uuid: UUID

Universally unique identifier of location data.