Name Description Size Mozhttpd is a simple http webserver written in python, designed expressly for use in automated testing scenarios. It is designed to both serve static content and provide simple web services. The server is based on python standard library modules such as SimpleHttpServer, urlparse, etc. The ThreadingMixIn is used to serve each request on a discrete thread. Some existing uses of mozhttpd include Peptest_, Eideticker_, and Talos_. .. _Peptest: .. _Eideticker: .. _Talos: The following simple example creates a basic HTTP server which serves content from the current directory, defines a single API endpoint `/api/resource/<resourceid>` and then serves requests indefinitely: :: import mozhttpd @mozhttpd.handlers.json_response def resource_get(request, objid): return (200, { 'id': objid, 'query': request.query }) httpd = mozhttpd.MozHttpd(port=8080, docroot='.', urlhandlers = [ { 'method': 'GET', 'path': '/api/resources/([^/]+)/?', 'function': resource_get } ]) print "Serving '%s' at %s:%s" % (httpd.docroot,, httpd.port) httpd.start(block=True) 1722 Translates results of 'func' into a JSON response. 569 Details of a request. 12046