from wsgiref.simple_server import make_server
def app(env, start_response):
status = '200 OK'
headers = [('Content-type', 'text/plain')]
start_response(status, headers)
text = '漢字'
return ['{}: {}\n'.format(k,v).encode() for k,v in env.items()] + [text.encode()]
if __name__ == '__main__':
with make_server('', 8000, app) as httpd:
httpd.serve_forever()