Mercurial > hg > RequestDumpster
comparison requestdumpster/dumpster.py @ 1:4ab07b01ee63
begin to stub dumpster
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Tue, 30 Jun 2015 16:12:23 -0700 |
| parents | |
| children | 8ddcab56f340 |
comparison
equal
deleted
inserted
replaced
| 0:b53ce9bde2c8 | 1:4ab07b01ee63 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 """ | |
| 4 dump HTTP requests | |
| 5 """ | |
| 6 | |
| 7 import optparse | |
| 8 import wsgiref | |
| 9 | |
| 10 class RequestDumpster(object): | |
| 11 | |
| 12 def __init__(self): | |
| 13 """placeholder""" | |
| 14 | |
| 15 def __call__(self, environ, start_response): | |
| 16 """WSGI""" | |
| 17 | |
| 18 def main(args=sys.argv[1:]): | |
| 19 """CLI""" | |
| 20 | |
| 21 # parse command line arguments | |
| 22 parser = optparse.OptionParser(description=__doc__) | |
| 23 parser.add_option('-p', '--port', dest='port', | |
| 24 type='int', default=9555, | |
| 25 help="port to serve on") | |
| 26 options = parser.parse_args() | |
| 27 | |
| 28 # construct url | |
| 29 url = 'http://localhost:{port}/'.format(port=options.port) | |
| 30 | |
| 31 if __name__ == '__main__': | |
| 32 main() |
