Skip to content

Commit

Permalink
Support automatic customer creation in CreateKey
Browse files Browse the repository at this point in the history
  • Loading branch information
artemlos committed Jan 5, 2021
1 parent 99e7367 commit d5ffda3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 18 additions & 2 deletions licensing/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ def create_key(token, product_id, period = 0,\
add_or_use_existing_customer=False,\
trial_activation=False,\
max_no_of_machines=0,\
no_of_keys=1):
no_of_keys=1,\
name = None,\
email = None,\
company_name=None,\
enable_customer_association = False,\
allow_activation_management = False ):
"""
This method allows you to create a new license key. The license can
either be standalone or associated to a specific customer. It is also
Expand All @@ -170,6 +175,12 @@ def create_key(token, product_id, period = 0,\
duplicates based on the email, you can use the AddOrUseExistingCustomer
parameter.
The parameters "name", "email", "company_name", "enable_customer_association"
and "allow_activation_management" are used to create a new customer (or update an existing one)
and automatically associate it with the newly created license. Please note that you need to use an
access token with both "CreateKey" and "AddCustomer" permissions. Moreover, either
the parameter "new_customer" or "add_or_use_existing_customer" need to be set to True.
More docs: https://app.cryptolens.io/docs/api/v3/CreateKey/
"""

Expand All @@ -194,7 +205,12 @@ def create_key(token, product_id, period = 0,\
"AddOrUseExistingCustomer": add_or_use_existing_customer,\
"TrialActivation": trial_activation,\
"MaxNoOfMachines": max_no_of_machines,\
"NoOfKeys":no_of_keys})
"NoOfKeys":no_of_keys,\
"Name": name,\
"Email": email,\
"CompanyName": company_name,\
"EnableCustomerAssociation": enable_customer_association,\
"AllowActivationManagement": allow_activation_management})
except HTTPError as e:
response = e.read()
except URLError as e:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
setup(
name = 'licensing', # How you named your package folder (MyLib)
packages = ['licensing'], # Chose the same as "name"
version = '0.29', # Start with a small number and increase it with every change you make
version = '0.30', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'Client library for Cryptolens licensing Web API.', # Give a short description about your library
author = 'Cryptolens AB', # Type in your name
author_email = 'support@cryptolens.io', # Type in your E-Mail
url = 'https://cryptolens.io', # Provide either the link to your github or to your website
download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_29.tar.gz', # I explain this later on
download_url = 'https://github.com/Cryptolens/cryptolens-python/archive/v_30.tar.gz', # I explain this later on
keywords = ['software licensing', 'licensing library', 'cryptolens'], # Keywords that define your package best
classifiers=[
#'Development Status :: 5 - Stable', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
Expand Down

0 comments on commit d5ffda3

Please sign in to comment.