# HG changeset patch # User Jeff Hammel # Date 1450291892 28800 # Node ID eb260393caefb895a1e6124cba652651f8c64ef2 # Parent 83c51f45b82d69d975c68997afe1eae694f83df3 this is about as far as I want to get without webob diff -r 83c51f45b82d -r eb260393caef requestdumpster/dumpster.py --- a/requestdumpster/dumpster.py Wed Dec 16 10:31:00 2015 -0800 +++ b/requestdumpster/dumpster.py Wed Dec 16 10:51:32 2015 -0800 @@ -9,7 +9,7 @@ import os import sys import time -import wsgiref +from wsgiref import simple_server # module globals __all__ = ['RequestDumpster'] @@ -25,6 +25,10 @@ def __call__(self, environ, start_response): """WSGI""" + body = """{REQUEST_METHOD} {PATH_INFO} {SERVER_PROTOCOL}""".format(**environ) + + start_response('200 OK', [('Content-Type', 'text/plain')]) + return [body] def main(args=sys.argv[1:]): """CLI""" @@ -45,7 +49,10 @@ url = 'http://localhost:{port}/'.format(port=options.port) # serve some web - server = simple_server.make_server(host=host, port=int(port), app=app) + host = '127.0.0.1' + server = simple_server.make_server(host=host, + port=options.port, + app=app) print url try: server.serve_forever()