The CGIHTTPServer Module
The CGIHTTPServer
module shown in Example 7-39 is a simple HTTP server that can call external scripts through
the common gateway interface (CGI).
Example 7-39. Using the CGIHTTPServer Module
File: cgihttpserver-example-1.py import CGIHTTPServer import BaseHTTPServer class Handler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ["/cgi"] PORT = 8000 httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever()
Get Python Standard Library now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.