annotate when using async
This commit is contained in:
parent
2503b8ecaa
commit
751affef70
@ -14,6 +14,7 @@ from const import UTF8, REPORTING_TIMEOUT
|
||||
default_request_body = b'{"message":{"command":"aidgaf","data":{"username":"AdamOutler"}}}'
|
||||
request_headers = {}
|
||||
|
||||
|
||||
class IDGAFServer(BaseHTTPRequestHandler):
|
||||
""" This class handles the requests from the client. """
|
||||
|
||||
@ -56,7 +57,8 @@ class IDGAFServer(BaseHTTPRequestHandler):
|
||||
self.handle_response(code, body)
|
||||
return
|
||||
|
||||
thread = threading.Thread(target=self.send_async_request, args=(command,))
|
||||
thread = threading.Thread(
|
||||
target=self.send_async_request, args=(command,))
|
||||
thread.start()
|
||||
self.handle_response(200, json.dumps(command))
|
||||
|
||||
@ -67,6 +69,7 @@ class IDGAFServer(BaseHTTPRequestHandler):
|
||||
|
||||
Parameters:
|
||||
command: The command object received from the client. """
|
||||
print("using async for response")
|
||||
[code, body] = self.getGPTResponse(command)
|
||||
merged = merge.merge_dict_no_overwrite(json.loads(body), command)
|
||||
merged['hash'] = security.get_message_hash(json.dumps(merged))
|
||||
@ -87,8 +90,6 @@ class IDGAFServer(BaseHTTPRequestHandler):
|
||||
timeout=REPORTING_TIMEOUT)
|
||||
print(str(resp)+resp.text)
|
||||
|
||||
|
||||
|
||||
# gpt_response = requests.post(URL, json=data, headers=request_headers)
|
||||
|
||||
def getGPTResponse(self, command) -> [int, str]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user