ucsschool.veyon_client package#
Submodules#
ucsschool.veyon_client.client module#
- class ucsschool.veyon_client.client.VeyonClient(url: str, credentials: Dict[str, str], auth_method: AuthenticationMethod | None = AuthenticationMethod.AUTH_KEYS, default_host: str = 'localhost', idle_timeout: int = 60)[source]#
Bases:
objectCreates 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.
- property request_session#
- remove_session(host: str) None[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
- test_connection()[source]#
Check if the veyon WebAPI Server is reachable
- Raises:
VeyonConnectionError – if the there is no response.
- get_screenshot(host: str | None = None, screenshot_format: ScreenshotFormat | None = ScreenshotFormat.PNG, compression: int | None = 5, quality: int | None = 75, dimension: Dimension | None = None) bytes[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:
- Raises:
VeyonError – Can throw a VeyonError(10) if no framebuffer is available yet.
- set_feature(feature: Feature, host: str | None = None, active: bool | None = True, arguments: Dict[str, str] | None = None) 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: Feature, host: str | None = None) bool[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:
- get_user_info(host: str | None = None) VeyonUser[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:
ucsschool.veyon_client.models module#
- exception ucsschool.veyon_client.models.VeyonConnectionError[source]#
Bases:
ExceptionRaised when communication with the Veyon WebAPI Server is not possible
- exception ucsschool.veyon_client.models.VeyonError(message, code)[source]#
Bases:
ExceptionRaised when the Veyon WebAPI returns a non-zero error code
See the official documentation within https://docs.veyon.io/en/latest/developer/webapi.html#general for possible error codes.
- class ucsschool.veyon_client.models.ScreenshotFormat(value)[source]#
Bases:
Enum- PNG = 'png'#
- JPEG = 'jpeg'#
- class ucsschool.veyon_client.models.AuthenticationMethod(value)[source]#
Bases:
Enum- 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- 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:
tupleCreate new instance of VeyonUser(login, fullName, session)
- fullName#
Alias for field number 1
- login#
Alias for field number 0
- session#
Alias for field number 2