ucsschool.veyon_client package

Submodules

ucsschool.veyon_client.client module

class ucsschool.veyon_client.client.VeyonClient(url, credentials, auth_method=<AuthenticationMethod.AUTH_KEYS: '0c69b301-81b4-42d6-8fae-128cdd113314'>, default_host='localhost', idle_timeout=60)[source]

Creates a client that communicates with the Veyon API to control features and fetches 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
_get_headers(host=None)[source]
_reset_idle_time(host)[source]
_create_session(host)[source]
_get_connection_uid(host=None, renew_session=True)[source]

Fetches the connection uid for a given host from the cache or generates a new one if none is present or valid.

Parameters:
  • host – The host to fetch the connection uid for
  • renew_session – If set to False an exception is thrown if no valid session exists in the session cache
Returns:

The connection uid

Raises:

VeyonError – If renew_session=False and the cached connection does not exist or is invalid

remove_session(host)[source]

This function tries to close the currently cached connection to the host and then purges it from the cache

Parameters:host – The host to remove the session for
get_screenshot(host=None, screenshot_format=<ScreenshotFormat.PNG: '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

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”

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

ucsschool.veyon_client.models module

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

Bases: exceptions.Exception

class ucsschool.veyon_client.models.ScreenshotFormat[source]

Bases: enum.Enum

PNG = <ScreenshotFormat.PNG: 'png'>
JPEG = <ScreenshotFormat.JPEG: 'jpeg'>
_member_map_ = OrderedDict([('JPEG', <ScreenshotFormat.JPEG: 'jpeg'>), ('PNG', <ScreenshotFormat.PNG: 'png'>)])
_member_names_ = ['JPEG', 'PNG']
_member_type_

alias of object

_value2member_map_ = {'png': <ScreenshotFormat.PNG: 'png'>, 'jpeg': <ScreenshotFormat.JPEG: 'jpeg'>}
class ucsschool.veyon_client.models.AuthenticationMethod[source]

Bases: enum.Enum

AUTH_KEYS = <AuthenticationMethod.AUTH_KEYS: '0c69b301-81b4-42d6-8fae-128cdd113314'>
AUTH_LDAP = <AuthenticationMethod.AUTH_LDAP: '6f0a491e-c1c6-4338-8244-f823b0bf8670'>
AUTH_LOGON = <AuthenticationMethod.AUTH_LOGON: '63611f7c-b457-42c7-832e-67d0f9281085'>
AUTH_SIMPLE = <AuthenticationMethod.AUTH_SIMPLE: '73430b14-ef69-4c75-a145-ba635d1cc676'>
_member_map_ = OrderedDict([('AUTH_KEYS', <AuthenticationMethod.AUTH_KEYS: '0c69b301-81b4-42d6-8fae-128cdd113314'>), ('AUTH_LOGON', <AuthenticationMethod.AUTH_LOGON: '63611f7c-b457-42c7-832e-67d0f9281085'>), ('AUTH_LDAP', <AuthenticationMethod.AUTH_LDAP: '6f0a491e-c1c6-4338-8244-f823b0bf8670'>), ('AUTH_SIMPLE', <AuthenticationMethod.AUTH_SIMPLE: '73430b14-ef69-4c75-a145-ba635d1cc676'>)])
_member_names_ = ['AUTH_KEYS', 'AUTH_LOGON', 'AUTH_LDAP', 'AUTH_SIMPLE']
_member_type_

alias of object

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

Bases: enum.Enum

SCREEN_LOCK = <Feature.SCREEN_LOCK: 'ccb535a2-1d24-4cc1-a709-8b47d2b2ac79'>
INPUT_DEVICE_LOCK = <Feature.INPUT_DEVICE_LOCK: 'e4a77879-e544-4fec-bc18-e534f33b934c'>
USER_LOGOFF = <Feature.USER_LOGOFF: '7311d43d-ab53-439e-a03a-8cb25f7ed526'>
REBOOT = <Feature.REBOOT: '4f7d98f0-395a-4fff-b968-e49b8d0f748c'>
POWER_DOWN = <Feature.POWER_DOWN: '6f5a27a0-0e2f-496e-afcc-7aae62eede10'>
DEMO_SERVER = <Feature.DEMO_SERVER: 'e4b6e743-1f5b-491d-9364-e091086200f4'>
DEMO_CLIENT_FULLSCREEN = <Feature.DEMO_CLIENT_FULLSCREEN: '7b6231bd-eb89-45d3-af32-f70663b2f878'>
DEMO_CLIENT_WINDOWED = <Feature.DEMO_CLIENT_WINDOWED: 'ae45c3db-dc2e-4204-ae8b-374cdab8c62c'>
_member_map_ = OrderedDict([('REBOOT', <Feature.REBOOT: '4f7d98f0-395a-4fff-b968-e49b8d0f748c'>), ('POWER_DOWN', <Feature.POWER_DOWN: '6f5a27a0-0e2f-496e-afcc-7aae62eede10'>), ('USER_LOGOFF', <Feature.USER_LOGOFF: '7311d43d-ab53-439e-a03a-8cb25f7ed526'>), ('DEMO_CLIENT_FULLSCREEN', <Feature.DEMO_CLIENT_FULLSCREEN: '7b6231bd-eb89-45d3-af32-f70663b2f878'>), ('DEMO_CLIENT_WINDOWED', <Feature.DEMO_CLIENT_WINDOWED: 'ae45c3db-dc2e-4204-ae8b-374cdab8c62c'>), ('SCREEN_LOCK', <Feature.SCREEN_LOCK: 'ccb535a2-1d24-4cc1-a709-8b47d2b2ac79'>), ('INPUT_DEVICE_LOCK', <Feature.INPUT_DEVICE_LOCK: 'e4a77879-e544-4fec-bc18-e534f33b934c'>), ('DEMO_SERVER', <Feature.DEMO_SERVER: 'e4b6e743-1f5b-491d-9364-e091086200f4'>)])
_member_names_ = ['REBOOT', 'POWER_DOWN', 'USER_LOGOFF', 'DEMO_CLIENT_FULLSCREEN', 'DEMO_CLIENT_WINDOWED', 'SCREEN_LOCK', 'INPUT_DEVICE_LOCK', 'DEMO_SERVER']
_member_type_

alias of object

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

Bases: tuple

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

_asdict()

Return a new OrderedDict which maps field names to their values

_fields = ('login', 'fullname', 'session')
classmethod _make(iterable, new=<built-in method __new__ of type object>, len=<built-in function len>)

Make a new VeyonUser object from a sequence or iterable

_replace(_self, **kwds)

Return a new VeyonUser object replacing specified fields with new values

fullname

Alias for field number 1

login

Alias for field number 0

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)

_asdict()

Return a new OrderedDict which maps field names to their values

_fields = ('connection_uid', 'valid_until')
classmethod _make(iterable, new=<built-in method __new__ of type object>, len=<built-in function len>)

Make a new VeyonSession object from a sequence or iterable

_replace(_self, **kwds)

Return a new VeyonSession object replacing specified fields with new values

connection_uid

Alias for field number 0

valid_until

Alias for field number 1

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

Bases: tuple

Create new instance of Dimension(width, height)

_asdict()

Return a new OrderedDict which maps field names to their values

_fields = ('width', 'height')
classmethod _make(iterable, new=<built-in method __new__ of type object>, len=<built-in function len>)

Make a new Dimension object from a sequence or iterable

_replace(_self, **kwds)

Return a new Dimension object replacing specified fields with new values

height

Alias for field number 1

width

Alias for field number 0

ucsschool.veyon_client.utils module

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