My first wsgi middleware

import logging
log = logging.getLogger(__name__)
class foomid(object):
    def __init__(self, app, app_conf):
        self.app = app

    def __call__(self, environ, start_response):
        a = [str(e) for e in environ]
        a.sort()
        log.info("\n".join(a))
        response = self.app(environ, start_response)
        return response

I just want to see how to make middleware and I want to observe environ.

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s