summaryrefslogtreecommitdiff
path: root/day7/http_handler.py
diff options
context:
space:
mode:
Diffstat (limited to 'day7/http_handler.py')
-rw-r--r--day7/http_handler.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/day7/http_handler.py b/day7/http_handler.py
index e5a551b..4712afe 100644
--- a/day7/http_handler.py
+++ b/day7/http_handler.py
@@ -8,7 +8,7 @@ from config import *
import db
-def log_func(func):
+def log_requests(func):
def wrapper(*args, **kwargs):
address = kwargs['address'] if 'address' in kwargs else args[0]
method = kwargs['method'] if 'method' in kwargs else args[1]
@@ -26,7 +26,7 @@ def log_func(func):
return wrapper
-@log_func
+@log_requests
def process_request(address, method, url, http_ver, headers: dict, query):
if validate_url(url):
try:
@@ -116,7 +116,7 @@ def main(host, port):
connection.close()
del connection
- except KeyboardInterrupt:
+ except (KeyboardInterrupt, ConnectionError):
print('Stopping server...')
try:
@@ -133,5 +133,5 @@ def main(host, port):
if __name__ == '__main__':
- HOST, PORT = ADDR = '0.0.0.0', 4002
+ HOST, PORT = ADDR = '0.0.0.0', 4001
main(HOST, PORT)