Sessions

class terminusgps.wialon.session.WialonSession(scheme: str = 'https', host: str = 'hst-api.wialon.com', port: int = 443, sid: str | None = None, token: str | None = None, auth_hash: str | None = None, username: str | None = None, check_service: str | None = None)[source]

Starts or continues a Wialon API session.

Parameters:
  • scheme (str) – HTTP request scheme to use. Default is "https".

  • host (str) – Wialon API host url. Default is "hst-api.wialon.com".

  • port (int) – Wialon API port. Default is 443.

  • sid (str | None) – A Wialon API session id. Default is None.

  • token (str | None) – A Wialon API token. Default is environment variable "WIALON_TOKEN".

  • auth_hash (str | None) – A Wialon API authentication hash. Default is None.

  • username (str | None) – A Wialon user to operate as during the session.

  • check_service (str | None) – A Wialon service name to check before calling the Wialon API. Default is None.

Returns:

Nothing.

Return type:

None

auth_hash_login(auth_hash: str, username: str, check_service: str | None = None) None[source]

Logs in to a Wialon API session using an auth hash.

Parameters:
  • auth_hash (str) – An authorization hash.

  • username (str) – Wialon user to operate as during the Wialon API session.

  • check_service (str | None) – Name of a Wialon service to check if the user has access to. Default is None (no service check).

Returns:

Nothing.

Return type:

None

logout() None[source]

Logs out of the Wialon API session.

Raises:

WialonAPIError – If the Wialon API session logout failed.

Returns:

Nothing.

Return type:

None

token_login(token: str, username: str | None = None) None[source]

Logs in to a Wialon API session using a token.

Parameters:
  • token (str) – A Wialon API token.

  • username (str) – Wialon user to operate as during the Wialon API session. Default is None.

Returns:

Nothing.

Return type:

None

property gis_sid: str | None

GIS session id for the Wialon API session.

Type:

str | None

Value:

None

property id: str | None

Wialon API session id.

Shortcut property for WialonSession.wialon_api.sid.

Returns None if the session wasn’t logged in.

Type:

str | None

Value:

None

property uid: str | None

User id of the session’s authenticated Wialon user.

Type:

str | None

Value:

None

property username: str | None

Username of the session’s authenticated Wialon user.

Type:

str | None

Value:

None