Package dap :: Package util :: Module wsgi_intercept
[hide private]
[frames] | no frames]

Module wsgi_intercept

source code

wsgi_intercept.WSGI_HTTPConnection is a replacement for httplib.HTTPConnection that intercepts certain HTTP connections into a WSGI application.

Use 'add_wsgi_intercept' and 'remove_wsgi_intercept' to control this behavior.

Classes [hide private]
  wsgi_fake_socket
Handle HTTP traffic and stuff into a WSGI application object instead.
  WSGI_HTTPConnection
Intercept all traffic to certain hosts & redirect into a WSGI application object.

Functions [hide private]
  add_wsgi_intercept(host, port, app_create_fn, script_name='')
Add a WSGI intercept call for host:port, using the app returned by app_create_fn with a SCRIPT_NAME of 'script_name' (default '').
  remove_wsgi_intercept(host, port)
Remove the WSGI intercept call for (host, port).
  make_environ(inp, host, port, script_name)
Take 'inp' as if it were HTTP-speak being received on host:port, and parse it into a WSGI-ok environment dictionary.

Variables [hide private]
  debuglevel = 0
  _wsgi_intercept = {}

Imports: sys, httplib.HTTPConnection, cStringIO.StringIO, traceback


Function Details [hide private]

add_wsgi_intercept(host, port, app_create_fn, script_name='')

source code 
Add a WSGI intercept call for host:port, using the app returned by app_create_fn with a SCRIPT_NAME of 'script_name' (default '').

remove_wsgi_intercept(host, port)

source code 
Remove the WSGI intercept call for (host, port).

make_environ(inp, host, port, script_name)

source code 

Take 'inp' as if it were HTTP-speak being received on host:port, and parse it into a WSGI-ok environment dictionary. Return the dictionary.

Set 'SCRIPT_NAME' from the 'script_name' input, and, if present, remove it from the beginning of the PATH_INFO variable.

Variables Details [hide private]

debuglevel

None
Value:
0                                                                     
      

_wsgi_intercept

None
Value:
{}