class FileIntercept(object):
    """
    wsgi: middleware
    given request.path will call wsgi app matching that path instead
    of dispatching to the wrapped application
    """

def __init__(self, app, file_intercept={}):
    self._app = app
self._f = file_intercept

def __call__(self, environ, start_response):
    request = Request(environ)
if request.path.lower() in self._f:
    response = request.get_response(self._f[request.path.lower()])
else:
    response = request.get_response(self._app)
return response(environ, start_response)
Python перехватывает веб-трафик из браузера