Skip to content

Instantly share code, notes, and snippets.

View cheeming's full-sized avatar

Chew Chee Ming cheeming

View GitHub Profile
# the following is one way to generate self-signed cert for this test server
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
from http.server import HTTPServer,SimpleHTTPRequestHandler
from socketserver import BaseServer
import ssl
HOSTNAME = 'localhost'
HTTPS_PORT = 8443
httpd = HTTPServer((HOSTNAME, HTTPS_PORT), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket, keyfile='server.key', certfile='server.crt', server_side=True)