Skip to content

Commit

Permalink
Merge pull request #283 from dcermak/urllib3-2-plus
Browse files Browse the repository at this point in the history
Switch HTTPConnection from http.client to urllib3.connection
  • Loading branch information
rhatdan authored Jun 23, 2023
2 parents efe4995 + 517744e commit 464c105
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
9 changes: 3 additions & 6 deletions podman/api/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""
import collections
import functools
import http.client
import logging
import pathlib
import random
Expand All @@ -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

Expand Down Expand Up @@ -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__(
Expand Down
9 changes: 3 additions & 6 deletions podman/api/uds.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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__(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ coverage
fixtures~=4.0.0
pylint
pytest
requests-mock
requests-mock >= 1.11.0
tox

0 comments on commit 464c105

Please sign in to comment.