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.
16 lines
588 B
Python
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)
|