from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer

class CORSRequestHandler( SimpleHTTPRequestHandler ):
    def end_headers( self ):
        self.send_header( 'Access-Control-Allow-Origin', '*' )
        SimpleHTTPRequestHandler.end_headers(self)

if __name__ == '__main__':
    BaseHTTPServer.test( CORSRequestHandler, BaseHTTPServer.HTTPServer )
try:
    from http.server import SimpleHTTPRequestHandler
    import http.server as BaseHTTPServer
except ImportError:
    from SimpleHTTPServer import SimpleHTTPRequestHandler
    import BaseHTTPServer


class CORSRequestHandler( SimpleHTTPRequestHandler ):
    def end_headers( self ):
        self.send_header( 'Access-Control-Allow-Origin', '*' )
        SimpleHTTPRequestHandler.end_headers(self)

if __name__ == '__main__':
    BaseHTTPServer.test( CORSRequestHandler, BaseHTTPServer.HTTPServer )
Add python3 support to stop Steve whinging
Add python3 support to stop Steve whinging

+ try:
+     from http.server import SimpleHTTPRequestHandler
+     import http.server as BaseHTTPServer
+ except ImportError:
- from SimpleHTTPServer import SimpleHTTPRequestHandler
+     from SimpleHTTPServer import SimpleHTTPRequestHandler
- import BaseHTTPServer
+     import BaseHTTPServer
+ 
  
  class CORSRequestHandler( SimpleHTTPRequestHandler ):
      def end_headers( self ):
          self.send_header( 'Access-Control-Allow-Origin', '*' )
          SimpleHTTPRequestHandler.end_headers(self)
  
  if __name__ == '__main__':
      BaseHTTPServer.test( CORSRequestHandler, BaseHTTPServer.HTTPServer )
Add python3 support to stop Steve whinging
## Code Before:
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer

class CORSRequestHandler( SimpleHTTPRequestHandler ):
    def end_headers( self ):
        self.send_header( 'Access-Control-Allow-Origin', '*' )
        SimpleHTTPRequestHandler.end_headers(self)

if __name__ == '__main__':
    BaseHTTPServer.test( CORSRequestHandler, BaseHTTPServer.HTTPServer )
## Instruction:
Add python3 support to stop Steve whinging
## Code After:
try:
    from http.server import SimpleHTTPRequestHandler
    import http.server as BaseHTTPServer
except ImportError:
    from SimpleHTTPServer import SimpleHTTPRequestHandler
    import BaseHTTPServer


class CORSRequestHandler( SimpleHTTPRequestHandler ):
    def end_headers( self ):
        self.send_header( 'Access-Control-Allow-Origin', '*' )
        SimpleHTTPRequestHandler.end_headers(self)

if __name__ == '__main__':
    BaseHTTPServer.test( CORSRequestHandler, BaseHTTPServer.HTTPServer )