#!/usr/bin/env python import os def application(environ, start_response): status = '200 OK' template = """
I am website {title}
Accept-Encoding header was set to {acceptencoding}
""" output = template.format(title=os.environ.get("WEBSITE_NAME", "that nobody set a name for :("), acceptencoding=environ.get("HTTP_ACCEPT_ENCODING")) response_headers = [('Content-type', 'text/html'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output]