def dump_environ(environ, start_response):
 output = []
 keys = list(environ.keys())
 keys.sort()
 for k in keys:
  v = str(environ[k]).replace('\n', '\n    ')
  output.append(('%s: %s\n' % (k, v)))
 output.append('\n')
 content_length = environ.get('CONTENT_LENGTH', '')
 if content_length:
  output.append(environ['wsgi.input'].read(int(content_length)))
  output.append('\n')
 output = ''.join(output)
 if six.PY3:
  output = output.encode('utf8')
 headers = [('Content-Type', 'text/plain'), ('Content-Length', str(len(output)))]
 start_response('200 OK', headers)
 return [output]

def dump_environ ( environ , start_response ) : output = [ ] keys = list ( environ . keys ( ) ) keys . sort ( ) for k in keys : v = str ( environ [ k ] ) . replace ( '\n' , '\n    ' ) output . append ( ( '%s: %s\n' % ( k , v ) ) ) output . append ( '\n' ) content_length = environ . get ( 'CONTENT_LENGTH' , '' ) if content_length : output . append ( environ [ 'wsgi.input' ] . read ( int ( content_length ) ) ) output . append ( '\n' ) output = '' . join ( output ) if six . PY3 : output = output . encode ( 'utf8' ) headers = [ ( 'Content-Type' , 'text/plain' ) , ( 'Content-Length' , str ( len ( output ) ) ) ] start_response ( '200 OK' , headers ) return [ output ]
application which simply dumps the current environment variables out as a plain text response .