mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 03:46:55 +00:00
Make compatible with requests 2.29.0 and urllib3 2.0 (#613)
* Make compatible with requests 2.29.0. * This fix should also work with urllib3 2.0 according to urllib3 maintainer. * Add changelog fragment. * We still need the constraint for CI until Docker SDK for Python has a new release with a fix. * Make modifications to response_class as small as possible. * Revert "We still need the constraint for CI until Docker SDK for Python has a new release with a fix." This reverts commit 698d544a1e08308e8bf8b4e56ab78c5079f9a17b. * The pip coming with the ansible-core 2.11 alpine3 image seems to be too old.
This commit is contained in:
@@ -42,15 +42,20 @@ except ImportError:
|
||||
|
||||
try:
|
||||
from requests.packages import urllib3
|
||||
from requests.packages.urllib3 import connection as urllib3_connection # pylint: disable=unused-import
|
||||
except ImportError:
|
||||
try:
|
||||
import urllib3
|
||||
from urllib3 import connection as urllib3_connection # pylint: disable=unused-import
|
||||
except ImportError:
|
||||
URLLIB3_IMPORT_ERROR = traceback.format_exc()
|
||||
|
||||
class _HTTPConnectionPool(object):
|
||||
pass
|
||||
|
||||
class _HTTPConnection(object):
|
||||
pass
|
||||
|
||||
class FakeURLLIB3(object):
|
||||
def __init__(self):
|
||||
self._collections = self
|
||||
@@ -63,7 +68,12 @@ except ImportError:
|
||||
self.match_hostname = object()
|
||||
self.HTTPConnectionPool = _HTTPConnectionPool
|
||||
|
||||
class FakeURLLIB3Connection(object):
|
||||
def __init__(self):
|
||||
self.HTTPConnection = _HTTPConnection
|
||||
|
||||
urllib3 = FakeURLLIB3()
|
||||
urllib3_connection = FakeURLLIB3Connection()
|
||||
|
||||
|
||||
# Monkey-patching match_hostname with a version that supports
|
||||
|
||||
Reference in New Issue
Block a user