File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1453,6 +1453,27 @@ def GetMACAddress():
14531453
14541454 return ':' .join (['{:02x}' .format ((uuid .getnode () >> ele ) & 0xff ) for ele in range (0 ,8 * 6 ,8 )][::- 1 ])
14551455
1456+ def HasNotExpired (license_key , allow_usage_on_expiry_date = True ):
1457+
1458+ """
1459+ Checks that the license key has not expired. Cryptolens offers automatic blocking of licenses
1460+ on the server side, and it is recommended to set it up instead of relying on the client side (unless
1461+ your application is running in offline mode). For more details, please review
1462+ https://help.cryptolens.io/web-interface/keys-that-dont-expire
1463+ """
1464+
1465+ import datetime
1466+
1467+ if license_key == None :
1468+ return False
1469+
1470+ diff = license_key .expires .replace (tzinfo = datetime .timezone .utc ) - datetime .datetime .now (datetime .timezone .utc )
1471+
1472+ if allow_usage_on_expiry_date and diff >= datetime .timedelta (0 ) or not (allow_usage_on_expiry_date ) and diff > 0 :
1473+ return True
1474+
1475+ return False
1476+
14561477 def HasFeature (license_key , feature_name ):
14571478
14581479 """
You can’t perform that action at this time.
0 commit comments