diff --git a/.gitignore b/.gitignore index 8af90e1..fcc7d7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__ *.swp *.err -*.png \ No newline at end of file +*.png +venv/ \ No newline at end of file diff --git a/server/connections.py b/server/connections.py index 64581cd..575d0eb 100644 --- a/server/connections.py +++ b/server/connections.py @@ -1,4 +1,7 @@ -import cgi +try: + from urllib.parse import parse_qs +except: + from cgi import parse_qs class IllegalMethodException(BaseException): pass @@ -13,9 +16,9 @@ class Request: def fromEnv(self, env): if env["REQUEST_METHOD"] == "POST": - self.args = cgi.parse_qs(env['wsgi.input'].readline().decode(), True) + self.args = parse_qs(env['wsgi.input'].readline().decode(), True) elif env["REQUEST_METHOD"] == "GET": - self.args = cgi.parse_qs(env['QUERY_STRING'], True) + self.args = parse_qs(env['QUERY_STRING'], True) else: raise IllegalMethodException() diff --git a/server/daemon.py b/server/daemon.py index 492d72d..5aed1cd 100644 --- a/server/daemon.py +++ b/server/daemon.py @@ -1,4 +1,3 @@ -import cgi from server.connections import Request, Response import mimetypes import handler