Skip to main content
Python 3 package licensing 0.54. Reviewed source revision.

GetMachineCode

Compute this device’s machine code.

Parameters

Result

Returns a machine-code string, or None when the implementation cannot obtain a usable identifier. Operating-system commands or unavailable system information can also raise exceptions; handle a missing identifier before activating.

Checks

Computes an identifier only. It does not contact the licensing API or verify a license.

Example

The Python 3 examples use version 2. Keep the same version when comparing the returned activations.

IsOnRightMachine

Check whether the license contains the expected device or process identifier.

Parameters

Result

Returns True when an activation matches, otherwise False. A missing license object or a failure while computing its machine code can raise an exception. Check that license loading or activation succeeded first.

Checks

Compares machine identifiers, with the requested floating and overdraft modes. It does not verify the signature, expiry, blocking, features or the floating deadline. This check assumes Maximum Number of Machines is greater than 0.

GetMACAddress

Obtain a MAC-address-style identifier using Python’s uuid.getnode().

Result

Returns a colon-separated hexadecimal string. The underlying Python and operating-system calls determine how a node identifier is obtained.

Checks

This is an identifier helper, not a license check. Do not assume that it always identifies the same physical network adapter.

HasNotExpired

Compare the license’s expiry with the device clock.

Parameters

Result

With the default allow_usage_on_expiry_date=True, returns whether the remaining duration is greater than or equal to zero. Returns False for None. In version 0.54, setting allow_usage_on_expiry_date=False raises TypeError for a non-null license because that branch compares a duration with a number. Avoid that option until it is fixed.

Checks

Checks only expiry using the device clock. Despite the parameter’s name, the default comparison does not extend the expiry to the end of its calendar day.

HasFeature

Look up a feature path in the cryptolens_features data object.

Parameters

Result

Returns True or False; missing or empty feature data returns False. Malformed feature JSON or a missing license object can raise an exception.

Checks

Reads the JSON feature hierarchy in the data object’s StringValue. It does not check the eight Boolean flags (f1 to f8), signature or expiry.

FAQ

Check that Maximum Number of Machines is greater than 0. With a value of 0, activation does not register machine codes. Also use the same identifier and algorithm version for activation and the machine check.
Yes. Generate one random identifier when the process starts, send it as machine_code on activation, and pass it as custom_machine_code to the machine check with is_floating_license=True. Reuse that identifier for renewals and deactivation. See the floating guide.
Python SDK Reference