title: how to use keygen.sh API for python
body: <p>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 &amp; checks the policy from keygen.sh in python.</p>
  <p>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.</p>
  <p>any help would be hugely appreciated</p>
  <p>main.py</p>
  <pre><code>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(
              &quot;product-name&quot;,
              account_id = &quot;&quot;,
              keygen_verify_key = &quot;&quot;,
              product_id=&quot;&quot;,
              # cache_path=&quot;/tmp/license-cache.json&quot;,
              # 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(&quot;License Invalid&quot;)
  
          def success():
              print(&quot;&quot;)
              print(&quot;\n Select list:&quot;)
              print(&quot;[0] - Prices&quot;)
              print(&quot;[1] - Exit&quot;)
              tcg = input(&quot;Select (0-1): &quot;)
  
              if tcg == '0':
                  os.system('cls')
                  type()
              if tcg == '1':
                  print(&quot;&quot;)
                  exit()
  </code></pre>