py2to3 automatic conversion. Woot!
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import BaseHTTPServer
|
||||
import urlparse
|
||||
import http.server
|
||||
import urllib.parse
|
||||
import socket
|
||||
import threading
|
||||
from logbook import Logger
|
||||
@@ -68,13 +68,13 @@ if (window.location.href.indexOf('step=2') == -1) {{
|
||||
|
||||
|
||||
# https://github.com/fuzzysteve/CREST-Market-Downloader/
|
||||
class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
class AuthHandler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
if self.path == "/favicon.ico":
|
||||
return
|
||||
|
||||
parsed_path = urlparse.urlparse(self.path)
|
||||
parts = urlparse.parse_qs(parsed_path.query)
|
||||
parsed_path = urllib.parse.urlparse(self.path)
|
||||
parts = urllib.parse.parse_qs(parsed_path.query)
|
||||
msg = ""
|
||||
|
||||
step2 = 'step' in parts
|
||||
@@ -88,7 +88,7 @@ class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
# For implicit mode, we have to serve up the page which will take the hash and redirect useing a querystring
|
||||
pyfalog.info("Processing response from EVE Online.")
|
||||
msg = "Processing response from EVE Online"
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
pyfalog.error("Error in CREST AuthHandler")
|
||||
pyfalog.error(ex)
|
||||
msg = "<h2>Error</h2>\n<p>{}</p>".format(ex.message)
|
||||
@@ -106,9 +106,9 @@ class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
|
||||
|
||||
# http://code.activestate.com/recipes/425210-simple-stoppable-server-using-socket-timeout/
|
||||
class StoppableHTTPServer(BaseHTTPServer.HTTPServer):
|
||||
class StoppableHTTPServer(http.server.HTTPServer):
|
||||
def server_bind(self):
|
||||
BaseHTTPServer.HTTPServer.server_bind(self)
|
||||
http.server.HTTPServer.server_bind(self)
|
||||
self.settings = CRESTSettings.getInstance()
|
||||
|
||||
# Allow listening for x seconds
|
||||
@@ -156,5 +156,5 @@ class StoppableHTTPServer(BaseHTTPServer.HTTPServer):
|
||||
if __name__ == "__main__":
|
||||
httpd = StoppableHTTPServer(('', 6461), AuthHandler)
|
||||
t = threading.Thread(target=httpd.serve)
|
||||
raw_input("Press <RETURN> to stop server\n")
|
||||
input("Press <RETURN> to stop server\n")
|
||||
httpd.stop()
|
||||
|
||||
Reference in New Issue
Block a user