import requests from blessed import Terminal term = Terminal() server = "http://localhost:3000/assistant" user = "USERNAME GOES HERE" commands = "" response = "" print('\x1a') # print(term.home + term.clear) print(" ***************************************************************************") print(" * *") print(" * R28 MAIN TERMINAL *") print(" * *") print(" * MANUAL OVERRIDE *") print(" * *") print(" * (blank to cancel) *") print(" * *") print(" ***************************************************************************") def commit(commands): print("") print(" Sending...") response = requests.post(server, json={"user": user, "command":commands}) if response.status_code == 200: print("") print(" Sent!") print("\a") else: print(term.black_on_white(term.center('Error: ' + str(response.status_code)))) print("\a") print("\a") print("\a") # print (response) while True: print("\a") commands = input(" >> ") if (commands.lower() == 'exit') or (commands == ''): # print(term.home + term.clear) # print(term.bold_black_on_white(term.center('*** Session Ended ***'))) # print("") exit() else: commit(commands) exit() print("") # requests.post("http://localhost:3000/assistant", json={"user": "karpantschof", "command":"turn on living room lights"})