diff --git a/podman/api/ssh.py b/podman/api/ssh.py index e6aecc4d..8eb51153 100644 --- a/podman/api/ssh.py +++ b/podman/api/ssh.py @@ -4,7 +4,6 @@ """ import collections import functools -import http.client import logging import pathlib import random @@ -17,10 +16,8 @@ import time import xdg.BaseDirectory -try: - import urllib3 -except ImportError: - from requests.packages import urllib3 +import urllib3 +import urllib3.connection from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_RETRIES, HTTPAdapter @@ -151,7 +148,7 @@ def close(self): super().close() -class SSHConnection(http.client.HTTPConnection): +class SSHConnection(urllib3.connection.HTTPConnection): """Specialization of HTTPConnection to use a SSH forwarded socket.""" def __init__( diff --git a/podman/api/uds.py b/podman/api/uds.py index cc7fcfdd..9d87d5db 100644 --- a/podman/api/uds.py +++ b/podman/api/uds.py @@ -1,16 +1,13 @@ """Specialized Transport Adapter for UNIX domain sockets.""" import collections import functools -import http.client import logging import socket from typing import Optional, Union from urllib.parse import unquote, urlparse -try: - import urllib3 -except ImportError: - from requests.packages import urllib3 +import urllib3 +import urllib3.connection from requests.adapters import DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE, DEFAULT_RETRIES, HTTPAdapter @@ -45,7 +42,7 @@ def connect(self, **kwargs): # pylint: disable=unused-argument raise APIError(f"Unable to make connection to UDS '{netloc}'") from e -class UDSConnection(http.client.HTTPConnection): +class UDSConnection(urllib3.connection.HTTPConnection): """Specialization of HTTPConnection to use a UNIX domain sockets.""" def __init__( diff --git a/requirements.txt b/requirements.txt index 9ee7e831..67b5399f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,5 @@ requests>=2.24 setuptools sphinx tomli>=1.2.3; python_version<'3.11' -urllib3>=1.26.5,<2.0.0 +urllib3 wheel diff --git a/setup.cfg b/setup.cfg index 29a92c48..dbd311f3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,7 +37,7 @@ install_requires = pyxdg >=0.26 requests >=2.24 tomli>=1.2.3; python_version<'3.11' - urllib3 >= 1.26.5, < 2.0.0 + urllib3 # typing_extensions are included for RHEL 8.5 # typing_extensions;python_version<'3.8' diff --git a/test-requirements.txt b/test-requirements.txt index 13cee68f..d4c3a3c7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,5 +5,5 @@ coverage fixtures~=4.0.0 pylint pytest -requests-mock +requests-mock >= 1.11.0 tox