1
|
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()
|