From 06387f3ddafaf7de035104daf8344b1b1070e776 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 18 Mar 2016 14:22:21 +0000 Subject: [PATCH] Add urllib3 to the docs Update the README to reflect the modern condition. --- docs/index.rst | 1 + docs/urllib3.rst | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 docs/urllib3.rst diff --git a/docs/index.rst b/docs/index.rst index 6058670..5271ed2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,6 +15,7 @@ Examples http_client httplib2 requests + urllib3 urllib diff --git a/docs/urllib3.rst b/docs/urllib3.rst new file mode 100644 index 0000000..a3b60fc --- /dev/null +++ b/docs/urllib3.rst @@ -0,0 +1,32 @@ +urllib3_intercept +================== + +.. automodule:: wsgi_intercept.urllib3_intercept + + +Example: + +.. testcode:: + + import urllib3 + from wsgi_intercept import urllib3_intercept, add_wsgi_intercept + + pool = urllib3.PoolManager() + + + def app(environ, start_response): + start_response('200 OK', [('Content-Type', 'text/plain')]) + return [b'Whee'] + + + def make_app(): + return app + + + host, port = 'localhost', 80 + url = 'http://{0}:{1}/'.format(host, port) + urllib3_intercept.install() + add_wsgi_intercept(host, port, make_app) + resp = pool.requests('GET', url) + assert resp.data == b'Whee' + urllib3_intercept.uninstall()