Items

class terminusgps.wialon.items.base.WialonBase(id: str | int | None, session: WialonSession, *args, **kwargs)[source]

Base class for Wialon objects.

Public Data Attributes:

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


abstractmethod create(*args, **kwargs) int | None[source]

Creates a Wialon object and returns its id.

delete() None[source]

Deletes the Wialon object.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

has_access(other: Type[WialonBase]) bool[source]

Checks if this Wialon object has access to other.

Type:

bool

populate() None[source]

Retrieves and saves the latest data for the item from Wialon.

Raises:

AssertionError – If id wasn’t set.

Returns:

Nothing.

Return type:

None

rename(new_name: str) None[source]

Renames the Wialon object to the new name.

Parameters:

new_name (str) – A new name.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

set_measurement_unit(unit: WialonMeasurementUnit = WialonMeasurementUnit.US, convert: bool = False) None[source]

Sets the Wialon object’s measurement unit.

Parameters:
  • unit (WialonMeasurementUnit) – A Wialon measurement unit. Default is US.

  • convert (bool) – Whether or not to convert the object’s measurements before setting the new unit.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_afield(key: str, value: str) None[source]

Updates an admin field by key.

Parameters:
  • key (str) – An admin field key (name).

  • value (str) – A string.

Raises:
  • ValueError – If the admin field key was longer than 128 characters.

  • ValueError – If the admin field value was longer than 128 characters.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_cfield(key: str, value: str) None[source]

Updates a custom field by key.

Parameters:
  • key (str) – A custom field key (name).

  • value (str) – A string.

Raises:
  • ValueError – If the custom field key was longer than 128 characters.

  • ValueError – If the custom field value was longer than 128 characters.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_pfield(key: WialonProfileField, value: str) None[source]

Updates a profile field by key.

Parameters:
Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

property access_lvl: str

Access level of the Wialon object.

property afields: dict[str, str]

Admin fields for the Wialon object.

Type:

dict

property cfields: dict[str, str]

Custom fields for the Wialon object.

Type:

dict

property hw_type: str

Hardware type of the Wialon object.

property id: int | None

A Wialon object id.

Type:

int | None

property name: str

Name of the Wialon object.

property pfields: dict[str, str]

Profile fields for the Wialon object.

Type:

dict

property session: WialonSession

A valid Wialon API session.

Type:

WialonSession

class terminusgps.wialon.items.resource.WialonResource(*args, **kwargs)[source]

A Wialon resource/account.

Public Data Attributes:

is_dealer

Whether or not the resource/account has dealer rights.

is_account

Whether or not the resource is an account.

creator_id

The account user id, if the resource is an account.

Inherited from WialonBase

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

__init__(*args, **kwargs)

Sets _is_account to None.

create(creator_id, name[, skip_creator_check])

Creates a new Wialon resource.

delete()

Deletes all micro-objects assigned to the resource.

get_remaining_days()

Returns the remaining account days for the resource.

create_geofence(name, x, y[, _type, desc, ...])

Creates a geofence in Wialon for the resource.

is_migrated(unit)

Checks if a unit is migrated into the account.

set_dealer_rights([enabled])

Sets dealer rights on the account.

migrate_unit(unit)

Migrates a WialonUnit into the account.

update_plan(new_plan)

Updates the account billing plan.

create_account(billing_plan)

Transforms the resource into an account.

delete_account()

Deletes the account if it exists, as well as any micro-objects and macro-objects it contains.

enable_account()

Enables the Wialon account.

disable_account()

Disables the Wialon account.

set_minimum_days([days])

Sets the minimum days counter value to days.

add_days([days])

Adds days to the account.

set_settings_flags([flags, ...])

Sets account settings flags.

bind_unit_driver(unit_id, driver_id)

unbind_unit_driver(unit_id, driver_id)

create_driver(name[, code, desc, phone, ...])

Creates a driver for the resource and returns its id.

create_passenger(name, code[, phone, ...])

Creates a passenger/tag for the resource.

update_attachable_drivers(units)

Updates the pool of units for the resource to attach drivers to the new unit list.

update_attachable_passengers(units)

Updates the pool of units for the resource to attach passengers to the new unit list.

create_trailer(name, code[, desc, phone, ...])

Creates a trailer for the resource.

Inherited from WialonBase

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

Inherited from WialonBase

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


add_days(days: int = 30) None[source]

Adds days to the account.

Parameters:

days (int) – Number of days to add to the account. Default is 30.

Raises:
Returns:

Nothing.

Return type:

None

create(creator_id: str | int, name: str, skip_creator_check: bool = False) int | None[source]

Creates a new Wialon resource.

Parameters:
  • creator_id (str | int) – Creator user id.

  • name (str) – A name for the resource.

  • skip_creator_check (bool) – Bypass object creation restrictions while creating the resource.

Raises:
  • ValueError – If creator_id wasn’t a digit.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

The Wialon id for the new resource, if it was created.

Return type:

int | None

create_account(billing_plan: str) None[source]

Transforms the resource into an account.

Parameters:

billing_plan (str) – The name of a billing plan.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

create_driver(name: str, code: str = '', desc: str = '', phone: str = '', mobile_auth_code: str = '', custom_fields: dict[str, str] | None = None) int | None[source]

Creates a driver for the resource and returns its id.

Parameters:
  • name (str) – A name for the new driver.

  • code (str) – A unique code for the new driver.

  • desc (str) – Description for the driver.

  • phone (str) – A phone number in E.164 format.

  • mobile_auth_code (str) – Authentication code for Wialon mobile app.

  • custom_fields (dict | None) – Additional custom fields to add to the driver.

Returns:

The driver id, if created.

Return type:

int | None

create_geofence(name: str, x: float, y: float, _type: WialonGeofenceType = WialonGeofenceType.CIRCLE, desc: str = '', flags: int = 16, color: int = 7143940, text_color: int = 2167565, text_size: int = 12, width: int = 100, min_zoom: int = 4, max_zoom: int = 19) None[source]

Creates a geofence in Wialon for the resource.

Parameters:
  • name (str) – Name of the geofence.

  • x (float) – X-coordinate for the geofence.

  • y (float) – Y-coordinate for the geofence.

  • _type (int) – Optional. Type of Wialon geofence.

  • desc (str) – Optional. Description of the geofence.

  • flags (int) – Optional. Flags to use on the creation API call.

  • color (int) – Optional. Color of the geofence.

  • text_color (int) – Optional. Text color of the geofence.

  • text_size (int) – Optional. Text size of the geofence.

  • width (int) – Optional. Width of the geofence.

  • min_zoom (int) – Optional. Minimum zoom level the geofence will be visible at.

  • max_zoom (int) – Optional Maximum zoom level the geofence will be visible at.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

create_passenger(name: str, code: str, phone: str = '', custom_fields: dict[str, str] | None = None) None[source]

Creates a passenger/tag for the resource.

Parameters:
  • name (str) – A name for the new passenger.

  • code (str) – A unique code for the new passenger.

  • phone (str) –

    A phone number in E.164 format.

  • custom_fields (dict | None) – Additional custom fields to add to the passenger.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

create_trailer(name: str, code: str, desc: str = '', phone: str = '', custom_fields: dict[str, str] | None = None) None[source]

Creates a trailer for the resource.

Parameters:
  • name (str) – A name for the new trailer.

  • code (str) – A unique code for the new trailer.

  • desc (str) – A description for the trailer.

  • phone (str) –

    A phone number in E.164 format.

  • custom_fields (dict | None) – Additional custom fields to add to the trailer.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

delete() None[source]

Deletes all micro-objects assigned to the resource.

If the resource is an account, instead deletes all macro-objects and micro-objects assigned to the account.

Returns:

Nothing.

Return type:

None

delete_account() None[source]

Deletes the account if it exists, as well as any micro-objects and macro-objects it contains.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

disable_account() None[source]

Disables the Wialon account.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

enable_account() None[source]

Enables the Wialon account.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

get_remaining_days() int[source]

Returns the remaining account days for the resource.

is_migrated(unit: WialonBase) bool[source]

Checks if a unit is migrated into the account.

If the resource isn’t an account, this always returns False.

Parameters:

unit (WialonBase) – A Wialon object.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Whether or not the unit is migrated into the account.

Return type:

bool

migrate_unit(unit: WialonBase) None[source]

Migrates a WialonUnit into the account.

Parameters:

unit (WialonBase) – A Wialon object.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

set_dealer_rights(enabled: bool = False) None[source]

Sets dealer rights on the account.

You probably don’t need to use this method.

Parameters:

enabled (bool) – Whether or not to enable dealer rights on the account. Default is False.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

set_minimum_days(days: int = 0) None[source]

Sets the minimum days counter value to days.

Parameters:

days (int) – Number of days to set the counter to. Default is 0.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

set_settings_flags(flags: int = 32, block_balance_val: float = 0.0, deny_balance_val: float = 0.0) None[source]

Sets account settings flags.

Parameters:
  • flags (int) – A flag integer to set on the account.

  • block_balance_val (float) – Minimum amount on the account’s balance before blocking the account.

  • deny_balance_val (float) – Minimum amount on the account’s balance before denying the account.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_attachable_drivers(units: Collection[str | int]) None[source]

Updates the pool of units for the resource to attach drivers to the new unit list.

Parameters:

units (Collection) – A collection of unit ids.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_attachable_passengers(units: Collection[str | int]) None[source]

Updates the pool of units for the resource to attach passengers to the new unit list.

Parameters:

units (Collection) – A collection of unit ids.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_plan(new_plan: str) None[source]

Updates the account billing plan.

Parameters:

new_plan (str) – The name of a billing plan.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

property creator_id: int | None

The account user id, if the resource is an account.

Type:

int | None

property is_account: bool

Whether or not the resource is an account.

Type:

bool

property is_dealer: bool

Whether or not the resource/account has dealer rights.

If the resource is not an account, this always returns False.

Type:

bool

class terminusgps.wialon.items.retranslator.WialonRetranslator(id: str | int | None, session: WialonSession, *args, **kwargs)[source]

A Wialon retranslator.

Public Data Attributes:

Inherited from WialonBase

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

create(creator_id, name, config)

Creates a Wialon retranslator.

update_config(new_config)

Updates the retranslator config to the new config.

add_units(units)

Adds a list of units to the Wialon retranslator.

rm_units(units)

Naively removes a list of units from the Wialon retranslator.

start([stop])

Starts the Wialon retranslator.

stop()

Stops the Wialon retranslator.

Inherited from WialonBase

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

Inherited from WialonBase

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


add_units(units: list[WialonBase]) None[source]

Adds a list of units to the Wialon retranslator.

Parameters:

units (list) – A list of Wialon unit objects.

Raises:

WialonError – If something went wrong with Wialon.

Returns:

Nothing.

Return type:

None

create(creator_id: str | int, name: str, config: dict) int | None[source]

Creates a Wialon retranslator.

Parameters:
  • creator_id (str | int) – Creator user id.

  • name (str) – A name for the retranslator.

  • config (dict) – A Wialon retranslator configuration object.

Raises:
  • ValueError – If a required parameter was not provided.

  • WialonError – If something went wrong with Wialon.

Returns:

Nothing.

Return type:

None

rm_units(units: list[WialonBase]) None[source]

Naively removes a list of units from the Wialon retranslator.

Parameters:

units (list) – A list of Wialon unit objects.

Raises:

WialonError – If something went wrong with Wialon.

Returns:

Nothing.

Return type:

None

start(stop: int | None = None) None[source]

Starts the Wialon retranslator.

Raises:

WialonError – If something went wrong with Wialon.

Returns:

Nothing.

Return type:

None

stop() None[source]

Stops the Wialon retranslator.

Raises:

WialonError – If something went wrong with Wialon.

Returns:

Nothing.

Return type:

None

update_config(new_config: dict) None[source]

Updates the retranslator config to the new config.

Parameters:

new_config – A Wialon retranslator configuration.

Raises:

WialonError – If something went wrong with Wialon.

Returns:

Nothing.

Return type:

None

class terminusgps.wialon.items.route.WialonRoute(id: str | int | None, session: WialonSession, *args, **kwargs)[source]

A Wialon route.

Public Data Attributes:

Inherited from WialonBase

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

create(creator_id, name)

Creates a new Wialon route.

Inherited from WialonBase

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

Inherited from WialonBase

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


create(creator_id: str | int, name: str) int | None[source]

Creates a new Wialon route.

Parameters:
  • creator_id (str | int) – A Wialon user id.

  • name (str) – A name for the route.

Raises:
Returns:

The Wialon id for the new route, if it was created.

Return type:

int | None

class terminusgps.wialon.items.unit.WialonUnit(*args, **kwargs)[source]

A Wialon unit.

Public Data Attributes:

exists

Whether or not the unit exists in Wialon.

available_commands

Commands assigned to the unit.

imei_number

IMEI # for the unit.

iccid

SIM Card # for the unit, if any.

carrier

Name of the telecommunications company associated with the unit's SIM card, if any.

active

Whether or not the unit is activated.

Inherited from WialonBase

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

__init__(*args, **kwargs)

Sets _imei_number and _active to None.

create(creator_id, name, hw_type_id)

Creates a new Wialon unit.

populate()

Sets imei_number, active and image_uri.

get_position()

Returns the current position of the unit.

get_command_messages(start_time[, total, count])

execute_command(name, link_type[, timeout, ...])

Executes a command on the unit.

set_access_password(password)

Sets the unit's access password.

activate()

Activates the unit.

deactivate()

Deactivates the unit.

get_phone_numbers([cfield_key, afield_key])

Retrieves all phone numbers assigned to the unit.

Inherited from WialonBase

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

_validate_phone_number(phone)

Returns True if phone is a valid E.164 formatted phone number.

_get_afield_phone_numbers(key)

Retrives phone numbers saved in an admin field by key.

_get_cfield_phone_numbers(key)

Retrives phone numbers saved in a custom field by key.

_get_driver_phone_numbers()

Returns a list of phone numbers assigned to drivers attached to the unit.

Inherited from WialonBase

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


activate() None[source]

Activates the unit.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

create(creator_id: str | int, name: str, hw_type_id: str | int) int | None[source]

Creates a new Wialon unit.

Parameters:
  • creator_id (str | int) – Creator user id.

  • name (str) – A name for the new unit.

  • hw_type_id (str | int) – A Wialon hardware type id for the new unit.

Raises:
  • ValueError – If creator_id isn’t a digit.

  • ValueError – If hw_type_id isnt’ a digit.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

A new Wialon unit id, if created.

Return type:

int | None

deactivate() None[source]

Deactivates the unit.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

execute_command(name: str, link_type: str, timeout: int = 5, flags: int = 0, param: dict | None = None) None[source]

Executes a command on the unit.

Parameters:
  • name (str) – A Wialon command name.

  • link_type (str) – A protocol to use for the Wialon command.

  • timeout (int) – How long (in seconds) to wait before timing out command execution. Default is 5.

  • flags (int) – Flags to pass to the Wialon command execution.

  • param (dict | None) – Additional parameters to execute the command with.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

get_phone_numbers(cfield_key: str = 'to_number', afield_key: str = 'to_number') list[str][source]

Retrieves all phone numbers assigned to the unit.

This includes any attached drivers, custom/admin fields or otherwise assigned phone numbers.

Parameters:
  • cfield_key (str) – A custom field key used to retrieve phone numbers. Default is "to_number".

  • afield_key (str) – An admin field key used to retrieve phone numbers. Default is "to_number".

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

A list of phone numbers.

Return type:

list

get_position() dict[source]

Returns the current position of the unit.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

The unit’s current position.

Return type:

dict

Response format:

key

type

desc

"t"

datetime

Time (UTC)

"y"

float

Latitude

"x"

float

Longitude

"z"

float

Altitude

"s"

int

Speed

"c"

int

Course

"sc"

int

# of satellites

populate() None[source]

Sets imei_number, active and image_uri.

set_access_password(password: str) None[source]

Sets the unit’s access password.

Parameters:

password (str) – A new access password.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

property active: bool

Whether or not the unit is activated.

property available_commands: dict

Commands assigned to the unit.

Type:

dict

property carrier: str | None

Name of the telecommunications company associated with the unit’s SIM card, if any.

Type:

str | None

property exists: bool

Whether or not the unit exists in Wialon.

property iccid: str | None

SIM Card # for the unit, if any.

Type:

str | None

property imei_number: str

IMEI # for the unit.

Type:

str

class terminusgps.wialon.items.unit_group.WialonUnitGroup(id: str | int | None, session: WialonSession, *args, **kwargs)[source]

A Wialon unit group.

Public Data Attributes:

items

Returns a list of Wialon object ids in the group.

Inherited from WialonBase

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

create(creator_id, name)

Creates a new Wialon unit group and returns its id.

set_items(new_items)

Sets this group's members to a list of Wialon unit ids.

is_member(item)

Determines whether or not item is a member of the group.

add_item(item)

Adds a Wialon object to the group.

rm_item(item)

Removes a Wialon object from the group.

Inherited from WialonBase

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

Inherited from WialonBase

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


add_item(item: WialonBase) None[source]

Adds a Wialon object to the group.

Parameters:

item (WialonBase) – A Wialon object.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

create(creator_id: str | int, name: str) int | None[source]

Creates a new Wialon unit group and returns its id.

Parameters:
  • creator_id (str | int) – Creator user id.

  • name (str) – Name for the new unit group.

Raises:
  • ValueError – If creator_id wasn’t a digit.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

A new Wialon unit group id, if created.

Return type:

int | None

is_member(item: WialonBase) bool[source]

Determines whether or not item is a member of the group.

Parameters:

item (WialonBase) – A Wialon object.

Raises:
  • ValueError – If item didn’t have an id attribute.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

Whether or not item is a member of the group.

Return type:

bool

rm_item(item: WialonBase) None[source]

Removes a Wialon object from the group.

Parameters:

item (WialonBase) – A Wialon object.

Raises:
Returns:

Nothing.

Return type:

None

set_items(new_items: list[str]) None[source]

Sets this group’s members to a list of Wialon unit ids.

Parameters:

new_items (list) – A list of Wialon unit ids.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

property items: list[str]

Returns a list of Wialon object ids in the group.

Type:

list

class terminusgps.wialon.items.user.WialonUser(id: str | int | None, session: WialonSession, *args, **kwargs)[source]

A Wialon user.

Public Data Attributes:

Inherited from WialonBase

name

Name of the Wialon object.

hw_type

Hardware type of the Wialon object.

access_lvl

Access level of the Wialon object.

session

A valid Wialon API session.

id

A Wialon object id.

afields

Admin fields for the Wialon object.

cfields

Custom fields for the Wialon object.

pfields

Profile fields for the Wialon object.

Public Methods:

create(creator_id, name, password)

Creates a new Wialon user.

grant_access(item[, access_mask])

Grants the user access to item.

set_settings_flags(flags, mask)

Sets the user's settings flags.

reset_password(email, url)

Sends a password reset email for a user to email.

update_password(old_password, new_password)

Updates the user's password.

verify_auth(destination[, method])

Sends an authentication code to destination via method.

Inherited from WialonBase

__init__(id, session, *args, **kwargs)

Sets the Wialon session and id for the Wialon object.

__str__()

Returns the Wialon object id as a string.

__repr__()

Returns the Wialon object type and parameters used to initialize it.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

populate()

Retrieves and saves the latest data for the item from Wialon.

has_access(other)

Checks if this Wialon object has access to other.

set_measurement_unit([unit, convert])

Sets the Wialon object's measurement unit.

rename(new_name)

Renames the Wialon object to the new name.

delete()

Deletes the Wialon object.

update_pfield(key, value)

Updates a profile field by key.

update_afield(key, value)

Updates an admin field by key.

update_cfield(key, value)

Updates a custom field by key.

Private Methods:

Inherited from WialonBase

_get_cfield_id(key)

Returns a custom field id by key.

_get_afield_id(key)

Returns an admin field id by key.


create(creator_id: str | int, name: str, password: str) int | None[source]

Creates a new Wialon user.

Parameters:
  • creator_id (str | int) – Creator user id.

  • name (str) – Name for the new user.

  • password (str) – Password for the new user.

Raises:
  • ValueError – If creator_id wasn’t a digit.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

A new Wialon user id, if created.

Return type:

int | None

grant_access(item: WialonBase, access_mask: int = 3540009843) None[source]

Grants the user access to item.

Parameters:
Raises:
  • ValueError – If item didn’t have an id attribute.

  • WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

reset_password(email: str, url: str) None[source]

Sends a password reset email for a user to email.

Parameters:
  • email (str) – An email address.

  • url (str) – A password reset URL.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

set_settings_flags(flags: int, mask: int) None[source]

Sets the user’s settings flags.

Parameters:
  • flags (int) – A user settings flag integer.

  • mask (int) – A user settings flag mask.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

update_password(old_password: str, new_password: str) None[source]

Updates the user’s password.

Parameters:
  • old_password (str) – The user’s original password.

  • new_password (str) – A new password.

Raises:

WialonError – If something went wrong with a Wialon API call.

Returns:

Nothing.

Return type:

None

verify_auth(destination: str, method: str = 'email') str[source]

Sends an authentication code to destination via method.

Destination should be an email address or an E.164 format phone number.

Method can be "email" or "sms".

Parameters:
  • destination (str) – The email or phone number to send an auth code to.

  • method (str) – Authentication method to use. Default is "email".

Raises:
  • ValueError – If the authentication method wasn’t "email" or "sms".

  • WialonError – If something went wrong with a Wialon API call.

Returns:

An auth code string.

Return type:

str