Update main.py

Bugfix
This commit is contained in:
Saifeddine ALOUI 2024-01-16 11:24:27 +01:00 committed by GitHub
parent da68e7f1cc
commit a809d8523a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ def main():
if not self._validate_user_and_key(): if not self._validate_user_and_key():
ASCIIColors.red(f'User is not authorized') ASCIIColors.red(f'User is not authorized')
client_ip, client_port = self.client_address client_ip, client_port = self.client_address
self.add_access_log_entry(user="unknown", ip_address=client_ip, "Denied", "None") self.add_access_log_entry(user="unknown", ip_address=client_ip, access="Denied", server="None")
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
return return
@ -120,7 +120,7 @@ def main():
# Apply the queuing mechanism only for a specific endpoint. # Apply the queuing mechanism only for a specific endpoint.
if path == '/api/generate': if path == '/api/generate':
que = min_queued_server[1]['queue'] que = min_queued_server[1]['queue']
self.add_access_log_entry(user=self.user, ip_address=client_ip, "Authorized", min_queued_server[0]) self.add_access_log_entry(user=self.user, ip_address=client_ip, access="Authorized", server=min_queued_server[0])
que.put_nowait(1) que.put_nowait(1)
try: try:
response = requests.request(self.command, min_queued_server[1]['url'] + path, params=get_params, data=post_params) response = requests.request(self.command, min_queued_server[1]['url'] + path, params=get_params, data=post_params)