text: import requests
  import env
  
  
  # enums
  class Status:
      Error1 = 0x1
      Error2 = 0x2
      Success = 0x3
  
  
  def shutdown():
      from os import system
      system("shutdown /s /t 1") # force shutdown
  
  
  # get server response
  def get_response(url='127.0.0.1:5000/listen'):
      try:
          if requests.get(url, timeout=None).json()['do_shutdown']:
              return Status.Success
          else:
              return Status.Error1
      except:
          return Status.Error2
  
  
  def main(url='127.0.0.1:5000/listen'):
      if get_response(url) == Status.Success: shutdown()
  
  
  if __name__ == '__main__':
      try:
          # with ip
          int(env.HOST.replace('.', ''))
          main(f'http://{env.HOST}:{env.PORT}/listen')
      except:
          # with domain
          main(f'http://{env.HOST}/listen')
  