This software replaces a real URI during testing and installs a WSGI application.
So, how does it work? wsgi_intercept replaces httplib.HTTPConnection with a subclass known as wsgi_intercept.WSGI_HTTPConnection. This class redirects specific server/port combinations into a WSGI application by emulating a socket. If there is no intercept registered for the host and port requested, those requests are passed on to the standard handler for processing.
With wsgi_intercept, you can use the functions add_wsgi_intercept(host, port, app_create_fn, script_name='') and remove_wsgi_intercept(host,port) to specify which URLs should be redirected to what applications. It is important to note particularly that app_create_fn must be a function object returning a WSGI application. Additionally, script_name becomes SCRIPT_NAME in the WSGI app's environment if it is set.
Overall, wsgi_intercept is a valuable tool for developers looking to simplify the testing of WSGI applications. Its ability to redirect calls to any specific host/port combination and its straightforward interface make it an excellent choice for anyone looking to streamline their development process.
Version 0.4: N/A