Files
deb-python-wsgi-intercept/wsgi_intercept/requests_intercept.py
Chris Dent c464f2ec7a Dedupe the urllib3 monkey patching code
requests vendorizes urllib3 which makes monkey patching it while also
wanting to monkey patch proper urllib3 a bit hairy. Here we use a
factory to do the overrides for us. Hat tip to @FND for helping
with the thinking through of this.
2016-03-18 13:43:34 +00:00

16 lines
588 B
Python

"""Intercept HTTP connections that use
`requests <http://docs.python-requests.org/en/latest/>`_.
"""
from requests.packages.urllib3.connectionpool import (HTTPConnectionPool,
HTTPSConnectionPool)
from requests.packages.urllib3.connection import (HTTPConnection,
HTTPSConnection)
from ._urllib3 import make_urllib3_override
install, uninstall = make_urllib3_override(HTTPConnectionPool,
HTTPSConnectionPool,
HTTPConnection,
HTTPSConnection)