From 77c53a9d8ac8f24314b63659e05d0066d40a3a54 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 29 Sep 2012 08:44:00 -0400 Subject: [PATCH] scgi-test: convert urlparse -> urllib.parse for Python 3. --- posts/SCGI/scgi-test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/posts/SCGI/scgi-test.py b/posts/SCGI/scgi-test.py index e521f53..4f6ea3d 100755 --- a/posts/SCGI/scgi-test.py +++ b/posts/SCGI/scgi-test.py @@ -20,7 +20,10 @@ """ import socket as _socket -import urlparse as _urlparse +try: # Python 3 + import urllib.parse as _urllib_parse +except ImportError: # Python 2 + import urlparse as _urllib_parse __version__ = '0.1' @@ -66,10 +69,10 @@ def header(method, uri, data=None): # as $request_uri is what was originally sent by the browser # before any such modifications. Does not include the protocol # or host name. Example: /foo/bar.html - scheme,netloc,path,params,query,fragment = _urlparse.urlparse(uri) + scheme,netloc,path,params,query,fragment = _urllib_parse.urlparse(uri) # :///;?# scheme = netloc = '' - request_uri = _urlparse.urlunparse( + request_uri = _urllib_parse.urlunparse( (scheme, netloc, path, params, query, fragment)) document_uri = path strings = [ -- 2.26.2