-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Introduction | ||
Below is a short summary of what each script does: | ||
|
||
* `change_all_licenses.py` - changes maximum number of machines for all license keys in all products. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
The script below will set the maximum number of machines to the value 5 for all license keys in all products. | ||
This can be changed so that it only affects one product or you can change the action that is being performed. | ||
More methods that you could call are listed at https://app.cryptolens.io/docs/api/v3/Key. | ||
""" | ||
|
||
from licensing.models import * | ||
from licensing.methods import Key, Helpers, Message, Product, Customer, Data, AI | ||
|
||
# Token with GetProducts, GetKeys and Machine Lock Limit permission is needed. | ||
token = "please add your token" | ||
|
||
products = Product.get_products(token)[0] | ||
for product in products: | ||
print(product["id"]) | ||
product_id = product["id"] | ||
|
||
page_count = 1 | ||
while True: | ||
product_keys = Product.get_keys(token, product_id, page=page_count) | ||
|
||
for key in product_keys[0]: | ||
print(key["key"]) | ||
print(Key.machine_lock_limit(token, product_id, key["key"], 5)) | ||
|
||
if page_count > product_keys[2]["pageCount"]: | ||
break | ||
|
||
page_count += 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters