Sessions

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

Starts or continues a Wialon API session.

Parameters:
  • token (str | None) – A Wialon API token. If not provided, the environment variable "WIALON_TOKEN" is used.

  • sid (str | None) – An optional Wialon API session id. If provided, the session is continued.

  • 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.

Returns:

Nothing.

Return type:

None

login(token: str, flags: int | None = None) str[source]

Logs into the Wialon API, starts a new session then returns its id.

Parameters:
  • token (str) – An active Wialon API token.

  • flags (int) – A login response flag integer.

Raises:
  • WialonError – If the login fails.

  • AssertionError – If the login token was not set.

Returns:

The new session id.

Return type:

str

logout() None[source]

Logs out of the Wialon API session.

Returns:

Nothing.

Return type:

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 token: str

Wialon API token set during WialonSession.__init__().

Type:

str

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