1414from licensing .internal import HelperMethods
1515
1616class ActivatedMachine :
17- def __init__ (self , IP , Mid , Time , FriendlyName = "" ):
17+ def __init__ (self , IP , Mid , Time , FriendlyName = "" , FloatingExpires = "" ):
1818 self .IP = IP
1919 self .Mid = Mid
2020
2121 # TODO: check if time is int, and convert to datetime in this case.
2222 self .Time = Time
2323 self .FriendlyName = FriendlyName
24+ self .FloatingExpires = FloatingExpires
25+
26+ class Reseller :
27+
28+ """
29+ Information about the reseller.
30+ """
31+
32+ def __init__ (self , Id , InviteId , ResellerUserId , Created , Name , Url , Email , Phone , Description ):
33+ self .Id = Id
34+ self .InviteId = InviteId
35+ self .ResellerUserId = ResellerUserId
36+ self .Created = Created
37+ self .Name = Name
38+ self .Url = Url
39+ self .Email = Email
40+ self .Phone = Phone
41+ self .Description = Description
42+
2443
2544class LicenseKey :
2645
2746 def __init__ (self , ProductId , ID , Key , Created , Expires , Period , F1 , F2 ,\
2847 F3 , F4 , F5 , F6 , F7 , F8 , Notes , Block , GlobalId , Customer , \
2948 ActivatedMachines , TrialActivation , MaxNoOfMachines , \
30- AllowedMachines , DataObjects , SignDate , RawResponse ):
49+ AllowedMachines , DataObjects , SignDate , Reseller , RawResponse ):
3150
3251 self .product_id = ProductId
3352 self .id = ID
@@ -53,6 +72,7 @@ def __init__(self, ProductId, ID, Key, Created, Expires, Period, F1, F2,\
5372 self .allowed_machines = AllowedMachines
5473 self .data_objects = DataObjects
5574 self .sign_date = SignDate
75+ self .reseller = Reseller
5676 self .raw_response = RawResponse
5777
5878 @staticmethod
@@ -63,13 +83,18 @@ def from_response(response):
6383
6484 obj = json .loads (base64 .b64decode (response .license_key ).decode ('utf-8' ))
6585
86+ reseller = None
87+
88+ if "Reseller" in obj and obj ["Reseller" ] != None :
89+ reseller = Reseller (** obj ["Reseller" ])
90+
6691 return LicenseKey (obj ["ProductId" ], obj ["ID" ], obj ["Key" ], datetime .datetime .fromtimestamp (obj ["Created" ]),\
6792 datetime .datetime .fromtimestamp (obj ["Expires" ]), obj ["Period" ], obj ["F1" ], obj ["F2" ], \
6893 obj ["F3" ], obj ["F4" ],obj ["F5" ],obj ["F6" ], obj ["F7" ], \
6994 obj ["F8" ], obj ["Notes" ], obj ["Block" ], obj ["GlobalId" ],\
7095 obj ["Customer" ], LicenseKey .__load_activated_machines (obj ["ActivatedMachines" ]), obj ["TrialActivation" ], \
7196 obj ["MaxNoOfMachines" ], obj ["AllowedMachines" ], obj ["DataObjects" ], \
72- datetime .datetime .fromtimestamp (obj ["SignDate" ]), response )
97+ datetime .datetime .fromtimestamp (obj ["SignDate" ]),reseller , response )
7398
7499 def save_as_string (self ):
75100 """
0 commit comments