How To Create A localhost HTTPS Python Server

To create a python https server, create in your development directory...

import BaseHTTPServer, SimpleHTTPServer
import ssl
httpd = BaseHTTPServer.HTTPServer(('', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='localhost.pem', server_side=True)

And run python to start the server. To generate the self signed certificate...

openssl req -new -x509 -keyout localhost.pem -out localhost.pem -days 365 -nodes

Make sure the "Common Name" is the same name as the server, e.g. "localhost"

Creating an HTTPS server in Python