Skip to main content
Python 2 / IronPython implementation. Reviewed source revision.
Import these methods from the separate cryptolens_python2 module. This implementation provides activation, retrieval, trial-key creation and deactivation; it does not include the Python 3 SDK’s administrative methods.

activate

Activate a license for a machine or process.

Parameters

Result

Returns (license_key, message), where license_key is a LicenseKey object. This legacy implementation returns two items even when metadata=True; it does not return or separately verify metadata. Returns (None, message) on API rejection, a failed signature or a handled request/parsing error. A malformed RSA public key can raise an exception.

Checks

Requests a signed ModelVersion 2 activation response and verifies the license signature. It does not independently apply your application’s expiry, product, feature or machine checks. Web API reference.

Example

Replace the access token and RSA public key placeholders, product ID and example license key with your own values. example-device represents the identifier supplied by your application.

get_key

Retrieve license information without registering a device or renewing a floating seat.

Parameters

Result

Returns (license_key, message). The parsed license is a LicenseKey object. Even with metadata=True, this method returns two items; it does not return a separately verified metadata dictionary. Returns (None, message) on API rejection, a failed signature or a handled request/parsing error. A malformed RSA public key can raise an exception.

Checks

Requests a signed response and verifies the license signature. This legacy lookup does not explicitly send ModelVersion. It does not activate or renew a floating seat, enforce expiry, or reject a returned blocked flag by itself. Web API reference.

create_trial_key

Create a trial key for the specified machine, or retrieve its previously created trial key.

Parameters

Result

Returns (key_string, ''). The first item is the license-key string, not a LicenseKey object. Returns (None, message) on an API rejection or a handled request failure, including a missing key field. Invalid response JSON can raise an exception.

Checks

The API applies its trial-key rules. This method does not activate the returned key or verify a signed license; activate it using Key.activate. Web API reference.

deactivate

Release the activation identified by its machine code. Set floating=True for a floating seat.

Parameters

Result

Returns (True, '') when deactivation succeeds. Returns (False, message) for API rejection and (None, message) for a handled request failure. Malformed response data can raise an exception.

Checks

The API checks the access token’s permissions. This method does not verify a signed license response. Web API reference.

FAQ

Yes. Select both the Activate permission and the Deactivate permission on the access token. The Activate permission alone does not grant deactivation. See the access-token guide.
No. A LicenseKey returned by Key.activate has already passed the SDK’s signature check. Other checks depend on the application; see the license-check FAQ.
Call Key.activate with the same process identifier and floating interval for each renewal. Call Key.deactivate with the same identifier and floating=True when releasing it. Key.get_key does not renew the seat. See the floating guide for renewal timing and crash recovery.
Python SDK Reference