@@ -285,14 +285,44 @@ def extend_license(token, product_id, key, no_of_days):
285285 return (True , jobj ["message" ])
286286
287287 @staticmethod
288+ def unblock_key (token , product_id , key ):
289+ """
290+ This method will unblock a specific license key to ensure that it can
291+ be accessed by the Key.Activate method.
292+ To do the reverse, you can use the BlockKey method.
293+
294+ More docs: https://app.cryptolens.io/docs/api/v3/UnblockKey
295+ """
296+
297+ response = ""
298+
299+ try :
300+ response = HelperMethods .send_request ("/key/UnblockKey" , {"token" :token ,\
301+ "ProductId" :product_id ,\
302+ "Key" : key })
303+ except HTTPError as e :
304+ response = e .read ()
305+ except URLError as e :
306+ return (None , "Could not contact the server. Error message: " + str (e ))
307+ except Exception :
308+ return (None , "Could not contact the server." )
309+
310+ jobj = json .loads (response )
311+
312+ if jobj == None or not ("result" in jobj ) or jobj ["result" ] == 1 :
313+ if jobj != None :
314+ return (False , jobj ["message" ])
315+ else :
316+ return (False , "Could not contact the server." )
317+
318+ return (True , jobj ["message" ])
319+
288320 def block_key (token , product_id , key ):
289321 """
290- This method will block a specific license key to ensure that the key
291- cannot be accessible by most of the methods in the Web API
292- (activation, validation, optional field, and deactivation). Note,
293- blocking the key will still allow you to access the key in Web API 3,
294- unless otherwise stated for a given Web API 3 method.
295- To do the reverse, please see Unblock Key.
322+ This method will block a specific license key to ensure that it will
323+ no longer be possible to activate it. Note, it will still be possible
324+ to access the license key using the GetKey method.
325+ To do the reverse, you can use the Unblock Key method.
296326
297327 More docs: https://app.cryptolens.io/docs/api/v3/BlockKey
298328 """
0 commit comments