import sys import os import time from pprint import pformat def entrypoint(env, start_response): write_body = start_response("200 OK", [('Content-type', 'text/plain')]) if not "wsgi.input" in env: raise ValueError("Given environ does not contain any 'wsgi.input' key !") data_in = env["wsgi.input"] #for l in data_in: # write_body("POST data line : %s" % repr(l)) #data = data_in.readlines() while True: data = data_in.read(98) write_body(("POST data : %s\n====\n" % repr(data)).encode()) if not data: break write_body(("Environ data :\n'%s'\n====\n" % pformat(env)).encode()) return [b'Hello world !\n']