Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
artemlos committed May 7, 2024
1 parent d008f94 commit d4b3212
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BulkActionLicenseKeys/README.md
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.
31 changes: 31 additions & 0 deletions BulkActionLicenseKeys/change_all_licenses.py
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

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ This repository contains a collection of scripts/programs to generate reports an
many seats (aka machine codes) were used by a certain license over time.
* [Data Analysis](https://github.com/Cryptolens/reporting-tools/tree/master/DataAnalysis) - a collection of Python script to analyse
the Web API Log.
* [Bulk Action License Keys](https://github.com/Cryptolens/reporting-tools/tree/master/BulkActionLicenseKeys) - a script that allow you to perform a specific action on all license keys. This can either be a read-only action or an action that changes a certain setting of all licenses, either globally for all products or a specific product.

0 comments on commit d4b3212

Please sign in to comment.