Files
deb-python-falcon/tests/dump_wsgi.py
Kurt Griffiths 1379641638 chore(tox): Fix errors due to new versions of flake8 and requests (#949)
Also fix Jython incompatibilities that were discovered in the process.
2016-11-18 19:51:40 -06:00

30 lines
653 B
Python

def application(environ, start_response):
# wsgi_errors = environ['wsgi.errors']
start_response('200 OK', [
('Content-Type', 'text/plain')])
body = '\n{\n'
for key, value in environ.items():
# if isinstance(value, str):
body += ' "{0}": "{1}",\n'.format(key, value)
body += '}\n\n'
if not isinstance(body, bytes):
body = body.encode('utf-8')
return [body]
app = application
if __name__ == '__main__':
from wsgiref.simple_server import make_server
server = make_server('localhost', 8000, application)
print('Listening on localhost:8000...')
server.serve_forever()