Python
Python Example
Headers
Name
Value
Content-Type
application/json
Authorization
Key <token>
Body
Name
Description
licenseKey
License key provided by the bot.
productName
Name of the product.
version
Current product version.
userId
Customer discord user Id.
hwid
Hardware Id of the user.
import requests
import json
import subprocess
import time
def licenseCheck(key, product, userId, version):
hwid = str(subprocess.check_output("wmic csproduct get uuid")).split("\\r\\n")[1].strip("\\r").strip()
headers = {
"Content-Type": "application/json",
"Authorization": "Key " # Your authorization key recieved from our official bot (ex. Token <authkey>)
}
data = {
"licenseKey": key,
"product": product,
"userId": userId,
"version": version,
"hwid": hwid
}
response = requests.post("http://<DOMAIN>:<PORT>/api/v1/key", headers=headers, json=data)
data = response.text
parsed = json.loads(data)
if parsed["statusCode"] == 400 or parsed["statusCode"] == 403 or parsed["statusCode"] == 404:
print(f"\033[0mValidation failed ⟶ \033[0m( \033[31m{key}\033[0m )")
print(f"Reason: \033[0m( \033[31m❌ {parsed["message"]}\033[0m )")
time.sleep(5)
os._exit(1)
elif parsed["statusCode"] == 200:
print(f"License validated ⟶ \033[0m( \033[38;5;36m{key}\033[0m )")
print(f"Message: \033[0m( \033[38;5;36m✅ {parsed["message"]}\033[0m )")
time.sleep(5)
else:
print(f"\033[0mValidation failed ⟶ \033[0m( \033[31m{key}\033[0m )")
print(f"Reason: \033[0m( \033[31m❌ {parsed["message"]}\033[0m )")
time.sleep(5)
os._exit(1)
licenseKey = ""
productName = ""
userId = ""
version = ""
licenseCheck(licenseKey, productName, userId, version)
Last updated