From 86a7bd352c5d4764d2d51c2c938dcf62758c9be5 Mon Sep 17 00:00:00 2001 From: Daniel Miessler Date: Fri, 2 Feb 2024 02:03:06 -0800 Subject: [PATCH] Moved standalone client examples under /client. --- standalone_client_examples/extract_wisdom.py | 30 -------------------- 1 file changed, 30 deletions(-) delete mode 100644 standalone_client_examples/extract_wisdom.py diff --git a/standalone_client_examples/extract_wisdom.py b/standalone_client_examples/extract_wisdom.py deleted file mode 100644 index 65ffa7a..0000000 --- a/standalone_client_examples/extract_wisdom.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python3 - -import sys -import json -import requests - - -def send_request(prompt): - url = "http://hostorip.tld:13337/extwis" - headers = { - "Content-Type": "application/json", - "Authorization": "eJ4f1e0b-25wO-47f9-97ec-6b5335b2", - } - data = json.dumps({"input": prompt}) - response = requests.post(url, headers=headers, data=data) - - try: - print(response.json()["response"]) - except KeyError: - print("Error: The API response does not contain a 'response' key.") - print("Received response:", response.json()) - - -if __name__ == "__main__": - if len(sys.argv) > 1: - prompt = " ".join(sys.argv[1:]) - send_request(prompt) - else: - prompt = sys.stdin.read() - send_request(prompt)