gps_tracker.client package
Submodules
gps_tracker.client.asynchronous module
Asynchronous client for Invoxia API.
- class gps_tracker.client.asynchronous.AsyncClient(config: Config, session: Optional[aiohttp.ClientSession] = None)[source]
Bases:
objectAsynchronous client for Invoxia API.
- classmethod get_auth(config: Config) aiohttp.BasicAuth[source]
Form the authentication instance associated to a config.
- async get_devices(kind: Optional[str] = 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’).
- async get_locations(device: Tracker, not_before: Optional[datetime] = None, not_after: Optional[datetime] = 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
- 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
- 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_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]
gps_tracker.client.config module
Definition of Client configuration.
gps_tracker.client.datatypes module
Data-types returned by Invoxia API.
- class gps_tracker.client.datatypes.Android(id, created: Optional[str], name, timezone, version, serial)[source]
Bases:
DeviceDefinition of devices of type ‘android’.
- class gps_tracker.client.datatypes.Device(id, created: Optional[str], name, timezone, version)[source]
Bases:
objectBase class for devices.
- class gps_tracker.client.datatypes.Iphone(id, created: Optional[str], name, timezone, version, serial)[source]
Bases:
DeviceDefinition of devices of type ‘iphone’.
- class gps_tracker.client.datatypes.Tracker(id, created: Optional[str], name, timezone, version)[source]
Bases:
DeviceBase class for trackers.
- class gps_tracker.client.datatypes.Tracker01(id, created: Optional[str], name, timezone, version, serial, version_build, tracker_config: Dict[str, Any], tracker_status: Dict[str, Any], model: Optional[str] = None)[source]
Bases:
TrackerDefinition of devices of type ‘tracker_01’.
- tracker_config: TrackerConfig
Tracker configuration data.
- tracker_status: TrackerStatus
Tracker current status.
- class gps_tracker.client.datatypes.Tracker03(id, created: Optional[str], name, timezone, version, serial, version_build, tracker_config: Dict[str, Any], tracker_status: Dict[str, Any], model: Optional[str] = None)[source]
Bases:
Tracker01Definition of devices of type ‘tracker_03’.
- tracker_config: TrackerConfig
Tracker configuration data.
- tracker_status: TrackerStatus
Tracker current status.
- class gps_tracker.client.datatypes.TrackerConfig(board_name, color, firmware_path, icon: int, mode: int | str, network, network_config, network_region, notify_position, notify_long_walk, usage: str, image: Optional[str] = None, weight=None)[source]
Bases:
objectDefinition of tracker config data.
- icon: TrackerIcon
ID of the icon selected for this tracker.
- mode: TrackerMode
Operating mode of the tracker.
- usage: TrackerUsage
Tracker usage defined during device setup.
- class gps_tracker.client.datatypes.TrackerData(datetime: Optional[str], lat, lng, method, pkt_drop, precision, uuid)[source]
Bases:
objectDefinition of tracker location data.
- method: TrackerMethod
Method used for location acquisition.
- class gps_tracker.client.datatypes.TrackerIcon(value)[source]
Bases:
EnumEnumeration of tracker icons.
- ANIMAL = 37
- ANTENNA = 43
- BACKHOE_LOADER = 36
- BACKPACK = 5
- BEEHIVE = 41
- BIKE = 7
- BOAT = 8
- BRIEFCASE = 2
- CAR = 10
- CARAVAN = 12
- CARPARK = 42
- CART = 13
- CAT = 31
- DOG = 14
- EBIKE = 40
- GIRL = 34
- HANDBAG = 1
- HEALTH = 44
- HELICOPTER = 18
- KAYAK = 15
- KEYS = 46
- LAPTOP = 16
- MAN = 39
- MOTO = 17
- OTHER = 0
- PERSON = 32
- PHONE = 48
- PLANE = 19
- SCOOTER = 21
- SUITCASE = 3
- TENT = 23
- TRACTOR = 26
- TRUCK = 24
- TV = 47
- UNKNOWN = -1
- WASHER = 45
- WOMAN = 38
- static from_value(value: int) TrackerIcon[source]
Convert an int value to class instance.
- class gps_tracker.client.datatypes.TrackerMethod(value)[source]
Bases:
EnumEnumeration of tracking methods.
- BLE_NEIGHBOR = 13
- BSSID = 3
- BSSID2 = 9
- BSSID3 = 10
- BSSID4 = 11
- BSSID_TGU = 7
- FLEET_CORRECTION = 12
- GPS = 2
- GPS_BLE = 14
- NETWORK = 1
- PHONE = 6
- PHONE2 = 15
- PLACE = 4
- SERVER = 8
- UBISCALE = 5
- UNKNOWN = 0
- class gps_tracker.client.datatypes.TrackerMode(value)[source]
Bases:
EnumEnumeration of possible tracker modes.
- AIRPLANE = 6
- CHILD = 3
- CHILD_PET = 23
- DAILY = 1
- DAILY_PET = 21
- INTENSE = 2
- INTENSE_PET = 22
- KEEP_ALIVE = 4
- LOST = 7
- LOST_PET = 27
- LOST_PET_DEBUG = 24
- LWT3 = 235
- UNKNOWN = -1
- VEHICLE_S1 = 8
- VEHICLE_S2 = 9
- VEHICLE_S3 = 10
- static from_value(value: int | str) TrackerMode[source]
Convert a value to class instance.
- class gps_tracker.client.datatypes.TrackerStatus(battery, begin_date: Optional[str], network_operator, state, stationary, sub_state, last_event: Optional[str] = None, last_location: Optional[str] = None, lost_pending=False, sub_end_date=None)[source]
Bases:
objectDefinition of tracker status data.
- class gps_tracker.client.datatypes.TrackerUsage(value)[source]
Bases:
EnumEnumeration of possible tracker usages.
- BIKE = 'bike'
- CAT = 'cat'
- CHILD = 'child'
- DOG = 'dog'
- MOTO = 'moto'
- OTHER = 'other'
- PERSON = 'person'
- PET = 'pet'
- TOOL = 'tool'
- UND = ''
- UNKNOWN = 'unknown'
- VEHICLE = 'vehicle'
- static from_value(value: str) TrackerUsage[source]
Convert a str value to class instance.
gps_tracker.client.exceptions module
Definition of exceptions possibly raised by the Client.
- exception gps_tracker.client.exceptions.ApiConnectionError[source]
Bases:
GpsTrackerExceptionException raised if connection error occurs during API call.
- exception gps_tracker.client.exceptions.FailedQuery(msg: Optional[str] = None, json_answer: Optional[Union[Dict, List]] = None)[source]
Bases:
HttpExceptionException raised for any erroneous status code.
- exception gps_tracker.client.exceptions.ForbiddenQuery(msg: Optional[str] = None, json_answer: Optional[Union[Dict, List]] = None)[source]
Bases:
HttpExceptionException raised when an API query is forbidden with current credentials.
- exception gps_tracker.client.exceptions.GpsTrackerException[source]
Bases:
ExceptionBase class for gps-tracker exceptions.
- exception gps_tracker.client.exceptions.HttpException(msg: Optional[str] = None, json_answer: Optional[Union[Dict, List]] = None)[source]
Bases:
GpsTrackerExceptionBase class for HTTP exceptions.
- static get(code: int) Optional[Type[HttpException]][source]
Return the subclass associated to code if it exists.
- Parameters
code (int) – HTTP code returned by the API call
- Returns
SubClass of HttpException with correct code if it exists
- Return type
Type[HttpException]
- static get_default() Optional[Type[HttpException]][source]
Return the subclass declared as default.
- exception gps_tracker.client.exceptions.NoContentQuery(msg: Optional[str] = None, json_answer: Optional[Union[Dict, List]] = None)[source]
Bases:
HttpExceptionException raised when API has no content to return.
- exception gps_tracker.client.exceptions.UnauthorizedQuery(msg: Optional[str] = None, json_answer: Optional[Union[Dict, List]] = None)[source]
Bases:
HttpExceptionException raised if credentials are incorrect.
- exception gps_tracker.client.exceptions.UnknownAnswerScheme(json_data, message, cls)[source]
Bases:
GpsTrackerExceptionException raised when API answer cannot be interpreted.
gps_tracker.client.synchronous module
Synchronous client for Invoxia API.
- class gps_tracker.client.synchronous.Client(config: Config)[source]
Bases:
objectSynchronous client for Invoxia API.
- get_devices(kind: Optional[str] = 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’).
- get_locations(device: Tracker, not_before: Optional[datetime] = None, not_after: Optional[datetime] = 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
- 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
- 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_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]
gps_tracker.client.url_provider module
URL provider for specific Invoxia API queries.
- class gps_tracker.client.url_provider.UrlProvider(api_url: str = 'https://labs.invoxia.io')[source]
Bases:
objectURL provider generates the API urls used to access user data.
- devices(kind: Optional[str] = None) str[source]
Form the URL to access all devices associated with current credentials.
- locations(device_id: int, not_before: Optional[int] = None, not_after: Optional[int] = None) str[source]
Form the URL to access tracker locations in a given time-range.
Module contents
Definitions of subpackage gps_tracker.client.