Items

Base

class terminusgps.wialon.items.base.WialonObject(session: WialonSession, id: int | str | None = None)[source]

Base class for Wialon objects in a Wialon session.

Public Data Attributes:

session

Wialon object API session.

id

Wialon object id.

Public Methods:

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from ABC

_abc_impl


abstractmethod create(*args, **kwargs) dict[str, str][source]

Creates the object in Wialon and sets its id.

delete() dict[str, str][source]

Deletes the object in Wialon.

delete_afield(id: int | str) dict[str, str][source]

Deletes an admin field by id in Wialon.

Parameters:

id (int | str) – Admin field id.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

delete_cfield(id: int | str) dict[str, str][source]

Deletes a custom field by id in Wialon.

Parameters:

id (int | str) – Custom field id.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

get_afields() list[dict[str, str]][source]

Returns a list of admin field dictionaries from Wialon.

Raises:
Returns:

A list of admin field dictionaries.

Return type:

list[dict[str, str]]

get_cfields() list[dict[str, str]][source]

Returns a list of custom field dictionaries from Wialon.

Raises:
Returns:

A list of admin field dictionaries.

Return type:

list[dict[str, str]]

get_name() str[source]

Gets and returns the object’s name from Wialon.

log_action(action: WialonLogAction, new_value: str, old_value: str) dict[str, str][source]

Creates a log record for the Wialon object.

set_afield(key: str, value: str, id: int | str | None = None) dict[str, str][source]

Sets an admin field in Wialon.

If id isn’t provided, a new admin field is created.

Parameters:
  • key (str) – Admin field key.

  • value (str) – Admin key value.

  • id (int | str | None) – Admin field id. If not provided, a new admin field is created. Default is None.

Raises:
Returns:

An admin field dictionary.

Return type:

dict[str, str]

set_cfield(key: str, value: str, id: int | str | None = None) dict[str, str][source]

Sets a custom field in Wialon.

Parameters:
  • key (str) – Custom field key.

  • value (str) – Custom field key value.

  • id (int | str | None) – Custom field id. If not provided, a new custom field is created. Default is None.

Raises:
Returns:

A custom field dictionary.

Return type:

dict[str, str]

set_name(name: str) dict[str, str][source]

Sets the object’s name in Wialon.

set_pfield(key: str, value: str) dict[str, str][source]

Sets a profile field for the object in Wialon.

Parameters:
  • key (str) – Profile field key.

  • value (str) – Profile field value.

Raises:
Returns:

A profile field dictionary.

Return type:

dict[str, str]

property id: int | None

Wialon object id.

property session: WialonSession

Wialon object API session.

Factories

class terminusgps.wialon.items.factory.WialonObjectFactory(session: WialonSession)[source]

Creates and retrieves Wialon objects from Wialon.

Public Methods:

__init__(session)

create()

Creates a Wialon object in Wialon and returns its Python equivalent.

get()

Retrieves a Wialon object from Wialon and returns its Python equivalent.

Private Methods:

_get_wialon_cls(items_type)

_create_wialon_obj(cls, *args, **kwargs)

_retrieve_wialon_obj(cls, id)


Wialon objects

class terminusgps.wialon.items.account.WialonAccount(session: WialonSession, id: int | str | None = None)[source]

A Wialon account.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(resource_id, billing_plan)

Creates the account in Wialon and sets its id.

delete([reasons])

Deletes the account in Wialon.

activate()

Enables the account in Wialon.

deactivate()

Disables the account in Wialon.

do_payment(balance_update, days_update, ...)

Makes an account payment in Wialon.

set_dealer_rights(enabled)

Enables or disables the account's dealer rights in Wialon.

set_flags(flags[, block_balance, deny_balance])

Sets settings flags for the account in Wialon.

set_plan(name)

Sets the account's billing plan to name.

set_minimum_days(days)

Sets the account's minimum days to days in Wialon.

get_data([response_type])

Returns account data from Wialon.

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


activate() dict[str, str][source]

Enables the account in Wialon.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

create(resource_id: int | str, billing_plan: str) dict[str, str][source]

Creates the account in Wialon and sets its id.

Parameters:
  • resource_id – A Wialon resource id.

  • billing_plan (str) – A Wialon account billing plan.

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

deactivate() dict[str, str][source]

Disables the account in Wialon.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

delete(reasons: Collection[str] | None = None) dict[str, str][source]

Deletes the account in Wialon.

Parameters:

reasons (Collection[str] | None) – An optional collection of reason strings. Default is None.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

do_payment(balance_update: Decimal, days_update: int, description: str) dict[str, str][source]

Makes an account payment in Wialon.

Parameters:
  • balance_update (Decimal) – Amount to update the account balance by. Can be negative.

  • days_update (str) – Amount of days to add to the account.

  • description (str) – A description for the payment.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

get_data(response_type: int = 1) dict[str, str][source]

Returns account data from Wialon.

Parameters:

response_type (int) – A response flag integer. Default is 1.

Raises:
Returns:

A dictionary containing the account’s data from Wialon.

Return type:

dict[str, str]

set_dealer_rights(enabled: bool) dict[str, str][source]

Enables or disables the account’s dealer rights in Wialon.

Parameters:

enabled (bool) – Whether to set the account as a dealer or not.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

set_flags(flags: int, block_balance: Decimal = Decimal('0.00'), deny_balance: Decimal = Decimal('0.00')) dict[str, str][source]

Sets settings flags for the account in Wialon.

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

  • block_balance (Decimal) – Balance required for account blocking. Default is 0.00.

  • deny_balance (Decimal) – Balance required for service denial. Default is 0.00.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

set_minimum_days(days: int) dict[str, str][source]

Sets the account’s minimum days to days in Wialon.

Parameters:

days (int) – Minimum number of days as an integer.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

set_plan(name: str) dict[str, str][source]

Sets the account’s billing plan to name.

Parameters:

name (str) – A Wialon billing plan name.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

class terminusgps.wialon.items.resource.WialonResource(session: WialonSession, id: int | str | None = None)[source]

A Wialon resource/account.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(creator_id, name[, skip_creator_check])

Creates the resource in Wialon and sets its id.

get_notification_data([notification_ids])

Returns the resource's notification data by id(s).

get_driver_bindings(start, stop[, unit_id, ...])

Returns the resource's bound drivers from start to stop.

get_creator_id()

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


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

Creates the resource in Wialon and sets its id.

Parameters:
  • creator_id (int | str) – A Wialon user id to set as the resource’s creator.

  • name (str) – Wialon resource name.

  • skip_creator_check (bool) – Whether to ignore creator check during the API call. Default is False.

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

get_driver_bindings(start: datetime, stop: datetime, unit_id: int | str = 0, driver_id: int | str = 0) dict[str, str][source]

Returns the resource’s bound drivers from start to stop.

Parameters:
  • start (datetime) – Interval start date/time.

  • stop (datetime) – Interval end date/time.

  • unit_id (int | str) – A Wialon unit id to retrieve drivers for. If not provided, assume all units in the resource.

  • driver_id (int) – A Wialon driver id to retrieve data for. If not provided, assume all drivers.

Raises:
Returns:

A dictionary of Wialon drivers.

Return type:

dict[str, str]

get_notification_data(notification_ids: Collection[int] | None = None) dict[str, str][source]

Returns the resource’s notification data by id(s).

Returns all notification data if notification_ids is None.

Parameters:

notification_ids (Collection[int] | None) – An optional collection of notification ids. Default is None.

Raises:
Returns:

A dictionary of notification data.

Return type:

dict[str, str]

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

A Wialon retranslator.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(creator_id, name, config)

Creates the retranslator in Wialon and sets its id.

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


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

Creates the retranslator in Wialon and sets its id.

Parameters:
  • creator_id (int | str) – A Wialon user id to set as the retranslator’s creator.

  • name (str) – Wialon retranslator name.

  • config (str) – Wialon retranslator configuration.

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

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

A Wialon route.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(creator_id, name)

Creates the route in Wialon and sets its id.

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


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

Creates the route in Wialon and sets its id.

Parameters:
  • creator_id (int | str) – A Wialon user id to set as the route’s creator.

  • name (str) – Wialon route name.

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

class terminusgps.wialon.items.unit.WialonUnit(session: WialonSession, id: int | str | None = None)[source]

A Wialon unit.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(creator_id, name, hw_type_id)

Creates the unit in Wialon and sets its id.

activate()

Activates the unit in Wialon.

deactivate()

Deactivates the unit in Wialon.

execute_command(command_name[, link_type, ...])

Executes a unit command in Wialon.

get_command_definitions([command_ids])

Returns the unit's command definition data by id(s).

get_imei()

Returns the IMEI (sys_unique_id) for the unit.

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


activate() dict[str, str][source]

Activates the unit in Wialon.

Raises:
Returns:

A dictionary with the unit’s current status.

Return type:

dict[str, str]

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

Creates the unit in Wialon and sets its id.

Parameters:
  • creator_id (int | str) – A Wialon user id to set as the unit’s creator.

  • name (str) – Wialon unit name.

  • hw_type_id (int | str) – A Wialon hardware type id.

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

deactivate() dict[str, str][source]

Deactivates the unit in Wialon.

Raises:
Returns:

A dictionary with the unit’s current status.

Return type:

dict[str, str]

execute_command(command_name: str, link_type: str = 'vrt', parameters: str = '', timeout: int = 300, flags: int = 0) dict[str, str][source]

Executes a unit command in Wialon.

Parameters:
  • command_name (str) – Name of the command.

  • link_type (str) – Link type to send the command with. Default is "vrt".

  • parameters (str) – Additional command execution parameters. Default is "".

  • timeout (int) – How long (in seconds) before timing out the command execution. Default is 300.

  • flags (int) – Command execution flags. Default is 0.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

get_command_definitions(command_ids: Collection[int] | None = None) dict[str, str][source]

Returns the unit’s command definition data by id(s).

Returns all command definition data if command_ids is None.

Parameters:

command_ids (Collection[int] | None) – An optional collection of command ids. Default is None.

Raises:
Returns:

A dictionary of command definition data.

Return type:

dict[str, str]

get_imei() str[source]

Returns the IMEI (sys_unique_id) for the unit.

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

A Wialon unit group.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(creator_id, name)

Creates the unit group in Wialon and sets its id.

update_units(unit_ids)

Sets the unit group's unit list in Wialon to unit_ids.

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


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

Creates the unit group in Wialon and sets its id.

Parameters:
  • creator_id (int | str) – A Wialon user id to set as the unit group’s creator.

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

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

update_units(unit_ids: Collection[int]) dict[str, str][source]

Sets the unit group’s unit list in Wialon to unit_ids.

Parameters:

unit_ids (Collection[int]) – A collection of Wialon unit ids.

Raises:
Returns:

A dictionary containing the unit group’s new unit list.

Return type:

dict[str, str]

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

A Wialon user.

Public Data Attributes:

Inherited from WialonObject

session

Wialon object API session.

id

Wialon object id.

Public Methods:

create(creator_id, name, password)

Creates the user in Wialon and sets its id.

get_access(object_type[, direct, flags])

Returns a dictionary of Wialon objects the user has access to.

set_access(obj, access_mask)

Sets the user's access to obj according to access_mask in Wialon.

set_flags(flags, flags_mask)

Sets the user settings flags in Wialon.

set_password(old_password, new_password)

Sets the user's password to new_password in Wialon.

Inherited from WialonObject

__init__(session[, id])

Sets the Wialon object's session and id.

__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 the object in Wialon and sets its id.

delete()

Deletes the object in Wialon.

set_name(name)

Sets the object's name in Wialon.

get_name()

Gets and returns the object's name from Wialon.

log_action(action, new_value, old_value)

Creates a log record for the Wialon object.

get_afields()

Returns a list of admin field dictionaries from Wialon.

set_afield(key, value[, id])

Sets an admin field in Wialon.

delete_afield(id)

Deletes an admin field by id in Wialon.

get_cfields()

Returns a list of custom field dictionaries from Wialon.

set_cfield(key, value[, id])

Sets a custom field in Wialon.

delete_cfield(id)

Deletes a custom field by id in Wialon.

set_pfield(key, value)

Sets a profile field for the object in Wialon.

Private Data Attributes:

_abc_impl

Inherited from WialonObject

_abc_impl

Inherited from ABC

_abc_impl


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

Creates the user in Wialon and sets its id.

Parameters:
  • creator_id (int | str) – A Wialon user id to set as the new user’s creator.

  • name (str) – Wialon user name.

  • password (str) – Wialon user password.

Raises:
Returns:

A Wialon object dictionary.

Return type:

dict[str, str]

get_access(object_type: str, direct: bool = True, flags: int = 1) dict[str, str][source]

Returns a dictionary of Wialon objects the user has access to.

Parameters:
  • object_type (str) – A Wialon object type.

  • direct (bool) – Whether or not to exclude objects the user doesn’t have direct access to. Default is True.

  • flags (int) – Response flags. Default is 0x1.

Raises:
Returns:

A dictionary of Wialon objects.

Return type:

dict[str, str]

set_access(obj: WialonObject, access_mask: int) dict[str, str][source]

Sets the user’s access to obj according to access_mask in Wialon.

Parameters:
  • obj (WialonObject) – A Wialon object.

  • access_mask (int) – A Wialon access mask integer.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]

set_flags(flags: int, flags_mask: int) dict[str, str][source]

Sets the user settings flags in Wialon.

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

  • flags_mask (int) – An integer mask which determines which bits will be changed.

Raises:
Returns:

A dictionary containing the user’s new settings flags.

Return type:

dict[str, str]

set_password(old_password: str, new_password: str) dict[str, str][source]

Sets the user’s password to new_password in Wialon.

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

  • new_password (str) – The user’s new Wialon password.

Raises:
Returns:

An empty dictionary.

Return type:

dict[str, str]