Removed use of cgi module to parse urls (which is deprecated in Python 2.7) and replace with urlparse.