#!/usr/bin/env python

import sys
import json
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from urlparse import urljoin
from urllib import URLopener

class ErrorHTTPRequestHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        get_conf = self.config['get']
        if self.path in get_conf:
            self.send_error(get_conf[self.path])
        elif "forward_to" in self.config:
            url = urljoin(self.config['forward_to'], self.path)
            self.log_request()
            self.log_message("Forwarding to {}".format(url))
            o = URLopener().open(url)
            self.wfile.write(o.read())
            o.close()
        else:
            self.send_error(get_conf['*'])

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

@@ -713,16 +713,47 @@
 %5B'*'%5D)%0A%0A
+if __name__ == %22__main__%22:%0A    
 if sys.a
@@ -761,24 +761,28 @@
 gv%5B1:%5D:%0A    
+ 
+   
 config_file 
@@ -796,16 +796,20 @@
 rgv%5B1:%5D%0A
+    
 else:%0A  
@@ -806,24 +806,28 @@
   else:%0A    
+ 
+   
 config_file 
@@ -840,16 +840,20 @@
 xyfile%22%0A
+    
 with ope
@@ -873,24 +873,28 @@
 ) as c:%0A    
+ 
+   
 config = jso
@@ -903,16 +903,20 @@
 load(c)%0A
+    
 ErrorHTT
@@ -947,16 +947,20 @@
  config%0A
+    
 httpd = 
@@ -1026,16 +1026,20 @@
 andler)%0A
+    
 httpd.se

Wrap main in an if __main__