ucsschool.veyon_client package

Submodules

ucsschool.veyon_client.client module

class ucsschool.veyon_client.client.VeyonClient(url, credentials, auth_method=AuthenticationMethod.AUTH_KEYS, default_host='localhost', idle_timeout=60)[source]

Bases: object

Creates a client that communicates with the Veyon API to control features and fetch screenshots.

Parameters
  • url – The url this client should connect to

  • credentials – The credentials used to authenticate against the Veyon API

  • auth_method – The method to use for authentication against the Veyon API

  • default_host – The default host to connect to if no specific host is provided

  • idle_timeout – The maximum time a connection can be idle without being invalidated by the server. Has to be a value > 0. If the given value is < 1, the value is set to 1.

remove_session(host)[source]

This function tries to close the currently cached connection to the host and then purges it from the cache. This function is not thread safe and thus needs to be used in an already thread safe context.

Parameters

host (str) – The host to remove the session for

get_screenshot(host=None, screenshot_format=ScreenshotFormat.PNG, compression=5, quality=75, dimension=None)[source]

Fetches a screenshot for the specified host from the Veyon API

Parameters
  • host – The host to fetch the screenshot for. If not specified the default host is used.

  • screenshot_format – The file format the screenshot should be returned as

  • compression – The compression level of the screenshot. Only used if the format is png

  • quality – The quality of the screenshot. Only used if format is jpeg

  • dimension – Optional specification of the screenshots dimensions as (width, height). If neither is specified (dimension=None) the original dimensions are used. If either is specified the other one is calculated in a way to keep the aspect ratio.

Returns

The screenshot as bytes

Return type

bytes

Raises

VeyonError – Can throw a VeyonError(10) if no framebuffer is available yet.

ping(host=None)[source]
set_feature(feature, host=None, active=True, arguments=None)[source]

De-/Activates a Veyon feature on the given host

Parameters
  • host – The host to set the feature for. If not specified the default host is used.

  • feature – The feature to set

  • active – True if the feature should be activated or triggered, False to deactivate a feature

  • arguments – A dictionary containing additional arguments for the feature

get_feature_status(feature, host=None)[source]

Fetches the status of a given feature on a given host.

Parameters
  • host – The host to fetch the feature status for. If not specified the default host is used.

  • feature – The feature to fetch the status for

Returns

True if the feature is activated, False if the feature is deactivated or has no status, like “REBOOT”

Return type

bool

get_user_info(host=None)[source]

Fetches the information about a logged in user on a given host

Parameters

host – The host to fetch the user info for. If not specified the default host is used.

Returns

The info about the logged in user. If no user is logged in the session field of the result will be -1

Return type

VeyonUser

ucsschool.veyon_client.models module

exception ucsschool.veyon_client.models.VeyonError(message, code)[source]

Bases: Exception

class ucsschool.veyon_client.models.ScreenshotFormat(value)[source]

Bases: enum.Enum

An enumeration.

PNG = 'png'
JPEG = 'jpeg'
class ucsschool.veyon_client.models.AuthenticationMethod(value)[source]

Bases: enum.Enum

An enumeration.

AUTH_KEYS = '0c69b301-81b4-42d6-8fae-128cdd113314'
AUTH_LDAP = '6f0a491e-c1c6-4338-8244-f823b0bf8670'
AUTH_LOGON = '63611f7c-b457-42c7-832e-67d0f9281085'
AUTH_SIMPLE = '73430b14-ef69-4c75-a145-ba635d1cc676'
class ucsschool.veyon_client.models.Feature(value)[source]

Bases: enum.Enum

An enumeration.

SCREEN_LOCK = 'ccb535a2-1d24-4cc1-a709-8b47d2b2ac79'
INPUT_DEVICE_LOCK = 'e4a77879-e544-4fec-bc18-e534f33b934c'
USER_LOGOFF = '7311d43d-ab53-439e-a03a-8cb25f7ed526'
REBOOT = '4f7d98f0-395a-4fff-b968-e49b8d0f748c'
POWER_DOWN = '6f5a27a0-0e2f-496e-afcc-7aae62eede10'
DEMO_SERVER = 'e4b6e743-1f5b-491d-9364-e091086200f4'
DEMO_CLIENT_FULLSCREEN = '7b6231bd-eb89-45d3-af32-f70663b2f878'
DEMO_CLIENT_WINDOWED = 'ae45c3db-dc2e-4204-ae8b-374cdab8c62c'
class ucsschool.veyon_client.models.VeyonUser(login, fullName, session)

Bases: tuple

Create new instance of VeyonUser(login, fullName, session)

property fullName

Alias for field number 1

property login

Alias for field number 0

property session

Alias for field number 2

class ucsschool.veyon_client.models.VeyonSession(connection_uid, valid_until)

Bases: tuple

Create new instance of VeyonSession(connection_uid, valid_until)

property connection_uid

Alias for field number 0

property valid_until

Alias for field number 1

class ucsschool.veyon_client.models.Dimension(width, height)

Bases: tuple

Create new instance of Dimension(width, height)

property height

Alias for field number 1

property width

Alias for field number 0

ucsschool.veyon_client.utils module

ucsschool.veyon_client.utils.check_veyon_error(response)[source]