Make compatible with current Python versions
This commit is contained in:
parent
edef07a592
commit
a6fecaae9f
3 changed files with 8 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ __pycache__
|
|||
*.swp
|
||||
*.err
|
||||
*.png
|
||||
venv/
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import cgi
|
||||
from server.connections import Request, Response
|
||||
import mimetypes
|
||||
import handler
|
||||
|
|
Loading…
Reference in a new issue