@@ -178,6 +178,46 @@ def deactivate(token, product_id, key, machine_code, floating = False):
178178
179179 return (True , "" )
180180
181+ @staticmethod
182+ def get_web_api_log (token , product_id = 0 , key = "" , machine_code = "" , friendly_name = "" ,\
183+ limit = 10 , starting_after = 0 , ending_before = 0 ):
184+
185+ """
186+ This method will retrieve a list of Web API Logs. All events that get
187+ logged are related to a change of a license key or data object, eg. when
188+ license key gets activated or when a property of data object changes. More details
189+ about the method that was called are specified in the State field.
190+
191+ More docs: https://app.cryptolens.io/docs/api/v3/GetWebAPILog
192+ """
193+
194+ response = ""
195+
196+ try :
197+ response = HelperMethods .send_request ("ai/getwebapilog" , {"token" :token ,\
198+ "ProductId" :product_id ,\
199+ "Key" :key ,\
200+ "MachineCode" :machine_code ,\
201+ "FriendlyName" :friendly_name ,\
202+ "Limit" : limit ,\
203+ "StartingAfter" : starting_after ,\
204+ "EndingBefore" : ending_before })
205+ except HTTPError as e :
206+ response = Response .from_string (e .read ())
207+ except URLError as e :
208+ return (None , "Could not contact the server. Error message: " + str (e ))
209+ except Exception :
210+ return (None , "Could not contact the server." )
211+
212+ jobj = json .loads (response )
213+
214+ if jobj == None or not ("result" in jobj ) or jobj ["result" ] == 1 :
215+ if jobj != None :
216+ return (False , jobj ["message" ])
217+ else :
218+ return (False , "Could not contact the server." )
219+
220+ return (jobj ["logs" ], "" )
181221
182222
183223class Helpers :
0 commit comments