# HG changeset patch # User Jeff Hammel # Date 1435713015 25200 # Node ID afa7a874d28e0e395ea7f1856e98148308caa145 # Parent 297f50637d4e775bc266f657bd00742f257b4984 dumpster; diff -r 297f50637d4e -r afa7a874d28e requestdumpster/dumpster.py --- a/requestdumpster/dumpster.py Tue Jun 30 18:07:36 2015 -0700 +++ b/requestdumpster/dumpster.py Tue Jun 30 18:10:15 2015 -0700 @@ -11,17 +11,21 @@ import time import wsgiref +# module globals +__all__ = ['RequestDumpster'] + class RequestDumpster(object): + """WSGI interface to dump HTTP requests""" def __init__(self, directory=None): if directory is not None and not os.path.isdir(directory): raise Exception("Not a directory") self.directory = directory - def __call__(self, environ, start_response): """WSGI""" + def main(args=sys.argv[1:]): """CLI""" @@ -30,8 +34,13 @@ parser.add_option('-p', '--port', dest='port', type='int', default=9555, help="port to serve on") + parser.add_option('-d', '--directory', dest='directory', + help="directory to output requests to") options = parser.parse_args() + # instantiate WSGI app + app = + # construct url url = 'http://localhost:{port}/'.format(port=options.port)