Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from wsgiref.simple_server import make_server
- def app(environ, start_response):
- if environ['PATH_INFO'] == '/':
- start_response('302 Found', {
- 'Location': '/foo%2Fbar/',
- 'Content-Type': 'text/plain'
- }.items())
- return ['Redirecting to /foo%2Fbar/']
- else:
- start_response('200 OK', {
- 'Content-Type': 'text/plain'
- }.items())
- return ('{0} = {1}\n'.format(k, environ[k]) for k in sorted(environ))
- httpd = make_server('', 8080, app)
- httpd.serve_forever()
Add Comment
Please, Sign In to add comment