
import BaseHTTPServer
import sys

class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(503)
        self.end_headers()
        self.wfile.write(
            'Your development environment is trying to connect to the KoBoCAT '
            'container on port 8000 instead of 8001. Please change this. See '
            'https://github.com/kobotoolbox/kobo-docker/issues/301 '
            'for more details.'
        )

server_address = ('', int(sys.argv[1]))
httpd = BaseHTTPServer.HTTPServer(server_address, Handler)
httpd.serve_forever()


import sys
from http.server import BaseHTTPRequestHandler, HTTPServer


class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(503)
        self.end_headers()
        self.wfile.write(
            b'Your development environment is trying to connect to the KoBoCAT '
            b'container on port 8000 instead of 8001. Please change this. See '
            b'https://github.com/kobotoolbox/kobo-docker/issues/301 '
            b'for more details.'
        )


server_address = ('', int(sys.argv[1]))
httpd = HTTPServer(server_address, Handler)
httpd.serve_forever()

Update wront port script to Python3
Update wront port script to Python3

  
- import BaseHTTPServer
  import sys
+ from http.server import BaseHTTPRequestHandler, HTTPServer
  
+ 
- class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
+ class Handler(BaseHTTPRequestHandler):
      def do_GET(self):
          self.send_response(503)
          self.end_headers()
          self.wfile.write(
-             'Your development environment is trying to connect to the KoBoCAT '
+             b'Your development environment is trying to connect to the KoBoCAT '
-             'container on port 8000 instead of 8001. Please change this. See '
+             b'container on port 8000 instead of 8001. Please change this. See '
-             'https://github.com/kobotoolbox/kobo-docker/issues/301 '
+             b'https://github.com/kobotoolbox/kobo-docker/issues/301 '
-             'for more details.'
+             b'for more details.'
          )
  
+ 
  server_address = ('', int(sys.argv[1]))
- httpd = BaseHTTPServer.HTTPServer(server_address, Handler)
+ httpd = HTTPServer(server_address, Handler)
  httpd.serve_forever()
  
Update wront port script to Python3
## Code Before:

import BaseHTTPServer
import sys

class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(503)
        self.end_headers()
        self.wfile.write(
            'Your development environment is trying to connect to the KoBoCAT '
            'container on port 8000 instead of 8001. Please change this. See '
            'https://github.com/kobotoolbox/kobo-docker/issues/301 '
            'for more details.'
        )

server_address = ('', int(sys.argv[1]))
httpd = BaseHTTPServer.HTTPServer(server_address, Handler)
httpd.serve_forever()

## Instruction:
Update wront port script to Python3
## Code After:

import sys
from http.server import BaseHTTPRequestHandler, HTTPServer


class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(503)
        self.end_headers()
        self.wfile.write(
            b'Your development environment is trying to connect to the KoBoCAT '
            b'container on port 8000 instead of 8001. Please change this. See '
            b'https://github.com/kobotoolbox/kobo-docker/issues/301 '
            b'for more details.'
        )


server_address = ('', int(sys.argv[1]))
httpd = HTTPServer(server_address, Handler)
httpd.serve_forever()
