#!/usr/bin/env python

import sys
import json
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

class ErrorHTTPRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(420)

if sys.argv[1:]:
    config_file = sys.argv[1:]
else:
    config_file = "Proxyfile"
with open(config_file) as c:
    config = json.load(c)
httpd = HTTPServer(("localhost", config['port']), ErrorHTTPRequestHandler)
httpd.serve_forever()

#!/usr/bin/env python

import sys
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

class ErrorHTTPRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(420)

if sys.argv[1:]:
    port = sys.argv[1:]
else:
    port = 8000
httpd = HTTPServer(("localhost", port), ErrorHTTPRequestHandler)
httpd.serve_forever()

--- 
+++ 
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 import sys
+import json
 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
 
 class ErrorHTTPRequestHandler(BaseHTTPRequestHandler):
@@ -8,8 +9,10 @@
         self.send_response(420)
 
 if sys.argv[1:]:
-    port = sys.argv[1:]
+    config_file = sys.argv[1:]
 else:
-    port = 8000
-httpd = HTTPServer(("localhost", port), ErrorHTTPRequestHandler)
+    config_file = "Proxyfile"
+with open(config_file) as c:
+    config = json.load(c)
+httpd = HTTPServer(("localhost", config['port']), ErrorHTTPRequestHandler)
 httpd.serve_forever()
Configure port via a Proxyfile
