KSC Open API
13.1
Kaspersky Security Center API description
|
Add a license to license storage of administration server. Due to the requirement to use licenses from activation 2.0 servers in priority use the following algorithm:
See also Python code with use of KlAkOAPI Python package below: server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False) oLicenseKeys = KlAkOAPI.LicenseKeys.KlAkLicenseKeys(server) wstrActivationCode = "XXXXX-XXXXX-XXXXX-XXXXX" try: wstrSerial = oLicenseKeys.InstallKey(KlAkOAPI.Params.KlAkParams({"KLLICSRV_KEYDATA": {"KLLIC_LICFILE": wstrActivationCode.encode('ascii'), "KLLIC_IFKEYFILE": False} })).RetVal() except KlAkOAPI.Error.KlAkError as err: if err.code == 2351 and (err.subcode == 3 or err.subcode == 34): # code KLOLA::KLOLA_ERR_SERVER (2351), subcode KLOLAEL_ERR_SERVER_1_REQUIRED (3) or KLOLAEL_ERR_LICENSE_NOT_FOUND (34) arrKeys = oLicenseKeys.DownloadKeyFiles(wstrActivationCode).RetVal() for arrKey in arrKeys: oLicenseKeys.InstallKey(KlAkOAPI.Params.KlAkParams({"KLLICSRV_KEYDATA": {"KLLIC_LICFILE": arrKey, "KLLIC_IFKEYFILE": False} })) else: raise
|