Tests about a simple python3 fastcgi runner using libfcgi and the Python-C API.
python
c
wsgi
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

foo_pep333.py 626B

1234567891011121314151617181920
  1. import sys
  2. import os
  3. import time
  4. from pprint import pformat
  5. def entrypoint(env, start_response):
  6. write_body = start_response("200 OK", [('Content-type', 'text/plain')])
  7. if not "wsgi.input" in env:
  8. raise ValueError("Given environ does not contain any 'wsgi.input' key !")
  9. data_in = env["wsgi.input"]
  10. #for l in data_in:
  11. # write_body("POST data line : %s" % repr(l))
  12. #data = data_in.readlines()
  13. while True:
  14. data = data_in.read(98)
  15. write_body(("POST data : %s\n====\n" % repr(data)).encode())
  16. if not data:
  17. break
  18. write_body(("Environ data :\n'%s'\n====\n" % pformat(env)).encode())
  19. return [b'Hello world !\n']