Skip to content

Instantly share code, notes, and snippets.

@christianb93
Created November 11, 2019 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianb93/ecf4d4cf2ba257e830ade110c13bf017 to your computer and use it in GitHub Desktop.
Save christianb93/ecf4d4cf2ba257e830ade110c13bf017 to your computer and use it in GitHub Desktop.
from wsgiref.simple_server import make_server
def application(environ, start_response):
start_response(
'200 OK',
[('Content-type', 'text/html')]
)
response = "<html><body><p><b>Environment data:</b></p>"
response += "<table><tr><th>Key</th><th>Value</th></tr>"
for key, value in environ.items():
response += "<tr><td>%s</td><td>%s</td></tr>" % ( key, value)
response = response + "</table></body></html>"
return [bytes(response, 'utf-8')]
print("Starting up")
httpd = make_server('', 8800, application)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment