Files
deb-python-wsgi-intercept/docs/interceptor.rst
Chris Dent 88cd440535 Fix handling of empty script name
This was revealed through testing with gabbi (to see if the
new Interceptor will work there).
2015-12-28 22:14:33 +00:00

29 lines
586 B
ReStructuredText

Interceptor
===========
.. automodule:: wsgi_intercept.interceptor
:members:
Example using `httplib2`, others are much the same:
.. testcode::
import httplib2
from wsgi_intercept.interceptor import Httplib2Interceptor
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return [b'Whee']
def make_app():
return app
http = httplib2.Http()
with Httplib2Interceptor(make_app, host='localhost', port=80) as url:
resp, content = http.request(url)
assert content == b'Whee'