1234567891011121314151617181920212223242526272829 |
- import sys
- import os
- import time
- import random
- from pprint import pformat
- random.seed()
-
- 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())
- print("Hello world !")
- print("False error :D", file=sys.stderr)
- 5/0
- time.sleep(random.randint(0,15)/1000)
- #time.sleep(random.randint(0,15)/100)
- #if random.randint(0,100) > 98:
- # time.sleep(3)
- return [b'Hello world !\n']
|