This was revealed through testing with gabbi (to see if the new Interceptor will work there).
586 B
586 B
Interceptor
wsgi_intercept.interceptor
Example using httplib2, others are much the same:
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'