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.
14 lines
521 B
Python
14 lines
521 B
Python
"""Intercept HTTP connections that use
|
|
`urllib3 <https://urllib3.readthedocs.org/>`_.
|
|
"""
|
|
|
|
from urllib3.connectionpool import HTTPConnectionPool, HTTPSConnectionPool
|
|
from urllib3.connection import HTTPConnection, HTTPSConnection
|
|
from ._urllib3 import make_urllib3_override
|
|
|
|
|
|
install, uninstall = make_urllib3_override(HTTPConnectionPool,
|
|
HTTPSConnectionPool,
|
|
HTTPConnection,
|
|
HTTPSConnection)
|