Created
February 25, 2019 12:40
-
-
Save artemlos/0c1e8059ea69d5a2514c09150a5cd2fb to your computer and use it in GitHub Desktop.
Get all keys in a product and write the to key.txt
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Mon Feb 25 13:34:54 2019 | |
@author: Artem Los | |
""" | |
import urllib.request | |
import json | |
# from https://github.com/Cryptolens/cryptolens-python | |
server_address = "https://app.cryptolens.io/api/" | |
def send_request(method, params): | |
return urllib.request.urlopen(server_address + method, \ | |
urllib.parse.urlencode(params)\ | |
.encode("utf-8")).read().decode("utf-8") | |
res = list(map(lambda x: x["key"] , json.loads(send_request("Product/GetKeys", \ | |
{"token":"access token",\ | |
"productId":"3843",\ | |
"page": "1"}))["licenseKeys"])) | |
print(res) | |
with open("keys.txt", 'w') as f: | |
for key in res: | |
f.write(key + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment