'how to use keygen.sh API for python
really sorry I am a noob coder trying to make it so users need to have entered a license key that gets stored on the local computer & checks the policy from keygen.sh in python.
so far I have the code below but I am struggling to find any documentation that could help me. I am currently using a libary I found called keygen_licensing_tools but I am unable to figure out how to go about this.
any help would be hugely appreciated
main.py
from uuid import getnode as get_mac
import requests
import json
import hashlib
import os
import sys
from keygen_licensing_tools import check_key
from list1 import type
class MainMenu:
while True:
license = check_key(
"product-name",
account_id = "",
keygen_verify_key = "",
product_id="",
# cache_path="/tmp/license-cache.json",
# optionals with default values:
# refresh_cache_period=timedelta(days=1),
# cache_age_warning=timedelta(days=3),
# cache_age_error=timedelta(days=7),
# expiry_warning=timedelta(days=7),
)
if license.is_valid:
success()
else:
print("License Invalid")
def success():
print("")
print("\n Select list:")
print("[0] - Prices")
print("[1] - Exit")
tcg = input("Select (0-1): ")
if tcg == '0':
os.system('cls')
type()
if tcg == '1':
print("")
exit()
Solution 1:[1]
Note: I don't have a keygen.sh account nor an API key. So I can't try it myself. So my answer is rather generic but hopefully points you in the right direction.
Looks like keygen_licensing_tools' GitHub repo does not exist anymore. Accessing the repo results in a 404 page and is either (temporary?) removed, moved or renamed (as of May 6, 2022).
You are probably better off using the API directly:
You can use (for example) requests to make the API calls.
Here is also a tutorial how to access an API using requests.
You'll first have to authenticate yourself and then you can access the desired endpoint. I am not sure which one that is as I can't lookup what check_key is doing.
Edit: The link you shared in your comment has a main.py which has two examples of API requests. I don't know if these are those you would need.
I recommend, read up how to use requests first (maybe even try another API for testing and understanding the package) and then go through keygen.sh's API to find what you need.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
