Items

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

Public Data Attributes:

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin fields for the Wialon object.

Public Methods:

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

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.


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

Adds an admin field to the Wialon object.

Parameters:
  • key (str) – A key (name) for the admin field.

  • value (str) – A value for the admin field.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Adds a custom field to the Wialon object.

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

  • value (str) – A value for the custom field.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Adds a custom property to the Wialon object.

Parameters:
  • key (str) – A key (name) for the custom property.

  • value (str) – A value for the custom property.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Adds a profile field to the Wialon object.

Parameters:
  • key (str) – A key (name) for the profile field.

  • value (str) – A value for the profile field.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

property afields: dict[str, str]

Admin fields for the Wialon object.

property cfields: dict[str, str]

Custom fields for the Wialon object.

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 goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Checks if this Wialon object has access to other.

Type:

bool

property id: int | None

A unique Wialon ID.

Type:

int | None

populate() None[source]

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

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 goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

property session: WialonSession

A valid Wialon API session.

Type:

WialonSession

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

Updates an admin field by id.

Parameters:
  • id (int) – The admin field id.

  • key (str) – A key (name) for the admin field.

  • value (str) – A value for the admin field.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Updates a custom field by id.

Parameters:
  • id (int) – The admin field id.

  • field (str) – A key (name) for the custom field.

  • field – A value for the custom field.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Public Data Attributes:

is_dealer

Whether or not the resource/account has dealer rights.

is_account

Whether or not the resource is an account.

Inherited from WialonBase

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin fields for the Wialon object.

Public Methods:

create(creator_id, name[, skip_creator_check])

Creates a new Wialon resource.

delete()

Deletes all micro-objects assigned to 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.

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

Creates a driver for the resource.

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)

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.


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 (int | str) – A Wialon user id.

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

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

Raises:
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:
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) None[source]

Creates a driver for the resource.

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 beginning in a country code. No spaces.

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

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

Raises:

WialonError – If something goes wrong calling the Wialon API.

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 beginning in a country code. No spaces.

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

Raises:

WialonError – If something goes wrong calling the Wialon API.

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 beginning in a country code. No spaces.

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

Raises:

WialonError – If something goes wrong calling the Wialon API.

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:
Returns:

Nothing.

Return type:

None

disable_account() None[source]

Disables the Wialon account.

Raises:
Returns:

Nothing.

Return type:

None

enable_account() None[source]

Enables the Wialon account.

Raises:
Returns:

Nothing.

Return type:

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

is_migrated(unit: WialonBase) bool[source]

Checks if a unit is migrated into the account.

Parameters:

unit (WialonBase) – A Wialon object.

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:
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) – True to enable dealer rights, False to disable dealer rights. Default is False.

Raises:
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:
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:
Returns:

Nothing.

Return type:

None

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

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

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

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

update_plan(new_plan: str) None[source]

Updates the account billing plan.

Parameters:

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

Raises:
Returns:

Nothing.

Return type:

None

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

Public Data Attributes:

Inherited from WialonBase

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin 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)

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.


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) – A Wialon 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]

Public Data Attributes:

Inherited from WialonBase

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin fields for the Wialon object.

Public Methods:

create(creator_id, name)

Creates a new Wialon route.

Inherited from WialonBase

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

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.


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(id: str | int | None, session: WialonSession, *args, **kwargs)[source]

Public Data Attributes:

position

Current GPS position of the unit.

exists

Whether or not the unit exists in Wialon.

available_commands

Assigned commands to the unit.

image_uri

An image URI for the unit.

imei_number

The unit's IMEI number.

active

Whether or not the unit is active.

Inherited from WialonBase

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin fields for the Wialon object.

Public Methods:

create(creator_id, name, hw_type_id)

Creates a new Wialon unit.

populate()

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

get_position()

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

Executes a command on the unit.

set_access_password(password)

Sets a new access password for the unit.

activate()

Activates the unit.

deactivate()

Deactivates the unit.

assign_phone(phone)

Assigns a phone number to the unit.

get_phone_numbers()

Retrieves all phone numbers assigned to the unit.

clean_phone_numbers(phones)

Takes a list of phone numbers and returns a list of clean phone numbers.

Inherited from WialonBase

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

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.

Private Methods:

_get_afield_phone_numbers([key])

Retrives any phone numbers saved in an admin field by key.

_get_cfield_phone_numbers([key])

Retrives any phone numbers saved in a custom field by key.

_get_driver_phone_numbers()

Retrieves any phone numbers assigned to drivers attached to the unit.


activate() None[source]

Activates the unit.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

property active: bool

Whether or not the unit is active.

assign_phone(phone: str) None[source]

Assigns a phone number to the unit.

Parameters:

phone (str) – A phone number beginning with a country code.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

property available_commands: dict

Assigned commands to the unit.

clean_phone_numbers(phones: list[str]) list[str][source]

Takes a list of phone numbers and returns a list of clean phone numbers.

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) – A Wialon user id.

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

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

Raises:
Returns:

An id for the new unit.

Return type:

int | None

deactivate() None[source]

Deactivates the unit.

Raises:

WialonError – If something goes wrong with Wialon.

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.

Returns:

Nothing.

Return type:

None

property exists: bool

Whether or not the unit exists in Wialon.

get_phone_numbers() list[str][source]

Retrieves all phone numbers assigned to the unit.

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

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

A list of phone numbers.

Return type:

list

property image_uri: str

An image URI for the unit.

property imei_number: int | None

The unit’s IMEI number.

populate() None[source]

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

property position: dict | None

Current GPS position of the unit.

set_access_password(password: str) None[source]

Sets a new access password for the unit.

Parameters:

password – A new access password.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Public Data Attributes:

items

Returns a list of the group's Wialon unit ids.

Inherited from WialonBase

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin fields for the Wialon object.

Public Methods:

create(creator_id, name)

Creates a new Wialon unit group.

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 item to the group.

rm_item(item)

Removes a Wialon unit from the group, if it's a member of the group.

Inherited from WialonBase

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

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.


add_item(item: WialonBase) None[source]

Adds a Wialon item to the group.

Parameters:

item (WialonBase) – A Wialon object.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Creates a new Wialon unit group.

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

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

Raises:
Returns:

The Wialon id for the new group, if it was 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:

WialonError – If something goes wrong with Wialon.

Returns:

True if item is a member of the group, else False.

Return type:

bool

property items: list[str]

Returns a list of the group’s Wialon unit ids.

Type:

list

rm_item(item: WialonBase) None[source]

Removes a Wialon unit from the group, if it’s a member of 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 goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Public Data Attributes:

units

The user's units.

groups

The user's unit groups.

Inherited from WialonBase

session

A valid Wialon API session.

id

A unique Wialon ID.

cfields

Custom fields for the Wialon object.

afields

Admin fields for the Wialon object.

Public Methods:

create(creator_id, name, password)

Creates a new Wialon user.

has_access(other)

Checks if the user has access to other.

assign_phone(phone)

Assigns a phone number to the user.

assign_email(email)

Assigns an email address to the user.

grant_access(item[, access_mask])

Grants the user access to item.

set_settings_flags(flags, flags_mask)

Sets the user's settings flags.

update_password(old_password, new_password)

Updates the password of the user.

verify_auth(destination[, method])

Sends an authentication code to destination via method.

Inherited from WialonBase

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

__str__()

Return str(self).

populate()

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

has_access(other)

Checks if this Wialon object has access to other.

create(*args, **kwargs)

Creates a Wialon object and returns its id.

rename(new_name)

Renames the Wialon object to the new name.

add_afield(key, value)

Adds an admin field to the Wialon object.

update_afield(id, key, value)

Updates an admin field by id.

add_cfield(key, value)

Adds a custom field to the Wialon object.

update_cfield(id, key, value)

Updates a custom field by id.

add_cproperty(key, value)

Adds a custom property to the Wialon object.

add_profile_field(key, value)

Adds a profile field to the Wialon object.

delete()

Deletes the Wialon object.

Private Methods:

_get_access_response(hw_type)

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


assign_email(email: str) None[source]

Assigns an email address to the user.

Parameters:

phone (str) – An email address.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

assign_phone(phone: str) None[source]

Assigns a phone number to the user.

Parameters:

phone (str) – A phone number, including country code.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Creates a new Wialon user.

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

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

  • password (str) – A password for the user.

Raises:
Returns:

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

Return type:

int | None

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

Grants the user access to item.

Parameters:
  • item (WialonBase) – A Wialon object.

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

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

property groups: list[str]

The user’s unit groups.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

A list of group ids the user has access to.

Return type:

list

has_access(other: WialonBase) bool[source]

Checks if the user has access to other.

Parameters:

other – A Wialon object.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

True if the user can access other, else False.

Return type:

bool

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

Sets the user’s settings flags.

Parameters:
  • flags (int) – The new user settings flags.

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

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

property units: list[str]

The user’s units.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

A list of unit ids the user has access to.

Return type:

list

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

Updates the password of the user.

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

  • new_password (str) – A new password.

Raises:

WialonError – If something goes wrong with Wialon.

Returns:

Nothing.

Return type:

None

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

Sends an authentication code to destination via method.

Method can be "email" or "sms".

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

  • method (str) – Email or sms. Default is "email".

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

  • WialonError – If something goes wrong with Wialon.

Returns:

An auth code.

Return type:

str