Utilities¶
- terminusgps.wialon.utils.generate_wialon_password(length: int = 32) str[source]¶
Generates a Wialon compliant password between
8and64characters.The generated password will contain:
At least one uppercase letter.
At least one lowercase letter.
At least one special symbol.
At least three digits.
- Parameters:
length (int) – Length of the generated password. Default is
32.- Raises:
ValueError – If
lengthwas less than8or greater than64.- Returns:
A Wialon compliant password.
- Return type:
- terminusgps.wialon.utils.get_unit_from_iccid(iccid: str, session: WialonSession, *, flags: int = 1, use_cache: bool = True, afield_key: str = 'iccid') dict[str, Any][source]¶
Returns a Wialon unit from a telecom iccid.
- Parameters:
iccid (str) – A telecom iccid number.
session (WialonSession) – A valid Wialon API session.
flags (int) – Wialon API response format flags. Default is
1.use_cache (bool) – Whether to use a cached Wialon API response or force a Wialon API call. Default is
True.afield_key (str) – Admin field key to search against. Default is
"iccid".
- Raises:
ValueError – If multiple units were found with the provided iccid.
ValueError – If zero units were found with the provided iccid.
WialonAPIError – If something went wrong calling the Wialon API.
- Returns:
A Wialon unit dictionary.
- Return type:
- terminusgps.wialon.utils.get_unit_from_imei(imei: str, session: WialonSession, *, flags: int = 1, use_cache: bool = True) dict[str, Any][source]¶
Returns a Wialon unit ID from an IMEI (sys_unique_id) number.
- Parameters:
imei (str) – An IMEI number.
session (WialonSession) – A valid Wialon API session.
flags (int) – Wialon API response format flags. Default is
1.use_cache (bool) – Whether to use a cached Wialon API response or force a Wialon API call. Default is
True.
- Raises:
ValueError – If multiple units were found with the provided IMEI number.
ValueError – If zero units were found with the provided IMEI number.
WialonAPIError – If something went wrong calling the Wialon API.
- Returns:
A Wialon unit dictionary.
- Return type:
- terminusgps.wialon.utils.get_units_from_carrier(carrier: str, session: WialonSession, *, use_cache: bool = True, afield_key: str = 'carrier', flags: int = 1, start: int = 0, end: int = 0) list[dict[str, Any]][source]¶
Returns a list of Wialon unit IDs by telecom carrier name.
The list may be empty if no units were found.
- Parameters:
carrier (str) – A telecom carrier name.
session (WialonSession) – A valid Wialon API session.
use_cache (bool) – Whether to use a cached Wialon API response or force a Wialon API call. Default is
True.afield_key (str) – Admin field key to search against. Default is
"carrier".flags (int) – Wialon API response flags. Default is
1.start (int) – Start index. Default is
0.end (int) – End index. Default is
0.
- Raises:
WialonAPIError – If something went wrong calling the Wialon API.
- Returns:
A list of Wialon unit dictionaries.
- Return type: