11import ctypes
2+ import json
23from cryptlex .lexfloatclient import lexfloatclient_native as LexFloatClientNative
34from cryptlex .lexfloatclient .lexfloatstatus_codes import LexFloatStatusCodes
45from cryptlex .lexfloatclient .lexfloatclient_exception import LexFloatClientException
@@ -19,6 +20,11 @@ def __init__(self, name, enabled, data):
1920 self .enabled = enabled
2021 self .data = data
2122
23+ class HostConfig (object ):
24+ def __init__ (self , hostConfig ):
25+ self .maxOfflineLeaseDuration = hostConfig .get ("maxOfflineLeaseDuration" )
26+
27+
2228class LexFloatClient :
2329 @staticmethod
2430 def SetHostProductId (product_id ):
@@ -117,7 +123,30 @@ def GetFloatingClientLibraryVersion():
117123 status = LexFloatClientNative .GetFloatingClientLibraryVersion (buffer ,buffer_size )
118124 if status != LexFloatStatusCodes .LF_OK :
119125 raise LexFloatClientException (status )
120- return LexFloatClientNative .byte_to_string (buffer .value )
126+ return LexFloatClientNative .byte_to_string (buffer .value )
127+
128+ @staticmethod
129+ def GetHostConfig ():
130+ """Gets the host configuration.
131+
132+ Raises:
133+ LexFloatClientException
134+
135+ Returns:
136+ str: host configuration.
137+ """
138+ buffer_size = 4096
139+ buffer = LexFloatClientNative .get_ctype_string_buffer (buffer_size )
140+ status = LexFloatClientNative .GetHostConfig (buffer , buffer_size )
141+ if status == LexFloatStatusCodes .LF_OK :
142+ host_config_json = LexFloatClientNative .byte_to_string (buffer .value )
143+ if not host_config_json .strip ():
144+ return []
145+ else :
146+ host_config = json .loads (host_config_json )
147+ return [HostConfig (host_config_details ) for host_config_details in host_config ]
148+ else :
149+ raise LexFloatClientException (status )
121150
122151 @staticmethod
123152 def GetHostProductVersionName ():
0 commit comments