solo1/web/simple-https-server.py

16 wiersze
424 B
Python
Czysty Zwykły widok Historia

2018-07-08 02:43:06 +00:00
# https://blog.anvileight.com/posts/simple-python-http-server/#python-3-x
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
2018-08-09 23:39:50 +00:00
host =('localhost', 4443)
2018-07-08 02:43:06 +00:00
httpd = HTTPServer(('localhost', 4443), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile="localhost.key",
certfile='localhost.crt', server_side=True)
2018-08-09 23:39:50 +00:00
print('serving on ', host)
2018-07-08 02:43:06 +00:00
httpd.serve_forever()